function openCartView() {
		var cartWindow = window.open("showcart.php","cartWindow","menubar=0,resizable=1,scrollbars=1,width=700,height=500");
		cartWindow.focus();
	}
	function showAllElements() {
	  //var elem = document.getElementById('randomPhotoBox');
	  //elem.style.visibility='visible';
          jQuery('#randomPhotoBox').css('visibility','visible');
	}
	function resize(which, max) {
	  var elem = document.getElementById(which);
//		  elem.style.visibility='hidden';
	  if (elem == undefined || elem == null) return false;
	  if (max == undefined) max = 312;
	  if (elem.width > elem.height) {
		if (elem.width > max) elem.width = max;
	  } else {
		if (elem.height > max) elem.height = max;
	  }
//		  elem.style.visibility='visible';
	}
	function openCartWindow(photoinfo,photosize) {
		var size;
		if(photosize==0) {
			productsize="small";
		}
		
		else if (photosize==1) {
			productsize="large";
		}
		var cartWindow = window.open("processcart.php?item_id="+photoinfo+"&item_size="+productsize,"cartWindow","menubar=0,resizable=1,scrollbars=1,width=700,height=500");
		cartWindow.focus();
	
	
	}
	if (document.images) {
		about_on = new Image();           // The onmouseover image
		about_on.src = "images/navmenu_about_on.png";  
		about_off = new Image();          // The normally seen image
		about_off.src = "images/navmenu_about.png"; 

		gallery_on = new Image();           // The onmouseover image
		gallery_on.src = "images/navmenu_gallery_on.png";  
		gallery_off = new Image();          // The normally seen image
		gallery_off.src = "images/navmenu_gallery.png"; 

		news_on = new Image();           // The onmouseover image
		news_on.src = "images/navmenu_news_on.png";  
		news_off = new Image();          // The normally seen image
		news_off.src = "images/navmenu_news.png"; 

		topphotos_on = new Image();           // The onmouseover image
		topphotos_on.src = "images/navmenu_topphotos_on.png";  
		topphotos_off = new Image();          // The normally seen image
		topphotos_off.src = "images/navmenu_topphotos.png"; 

		links_on = new Image();           // The onmouseover image
		links_on.src = "images/navmenu_links_on.png";  
		links_off = new Image();          // The normally seen image
		links_off.src = "images/navmenu_links.png"; 

		contact_on = new Image();           // The onmouseover image
		contact_on.src = "images/navmenu_contact_on.png";  
		contact_off = new Image();          // The normally seen image
		contact_off.src = "images/navmenu_contact.png"; 

		shoppingcart_on = new Image();           // The onmouseover image
		shoppingcart_on.src = "images/shoppingcart_on.png";  
		shoppingcart_off = new Image();          // The normally seen image
		shoppingcart_off.src = "images/shoppingcart.png"; 	
	  }				  //This function changes the image when over.
	function imgOn(imgName) {
			if (document.images) {
			document[imgName].src = eval(imgName + "_on.src");
			}
	}				   //This function changes the image back when off.
	function imgOff(imgName) {
			if (document.images) {
			document[imgName].src = eval(imgName + "_off.src");        
			}
	}
        
        var current_city;
        current_city = 0;
        function switchAlbumMode() {
				targetGallery = "index.php?r=gallery/albumview&city_id="+current_city;
				document.location.href=targetGallery;
				
			}
                        
                function setCurrentCity(city_id) {
				current_city = city_id;
			
			}
var selected_node;                        
function select_tree_node(nodeid)
{
    if(selected_node!=null)
    {
         jQuery(selected_node).removeClass('selected_tree_a');
    }
    selected_node = nodeid;
    jQuery(selected_node).addClass('selected_tree_a');
}

function open_node(nodea)
{
    //jQuery(nodea).next('ul').css('border','1px solid black;');
    /*jQuery(nodea).parent().trigger('click');
    return false;*/
    /*pdiv = jQuery(pli).find('div.hitarea');
    jQuery(pdiv).trigger('click');*/
}

function search_focus(ele)
{
                if(ele.value == 'Enter Keywords')
                               ele.value  = '';
}

function search_blur(ele)
{
                if(ele.value == '')
                                ele.value = 'Enter Keywords';
}

function submit_search()
{
                search_value = $("#query").val();
                form = $("#search_form");
                
                if(jQuery.trim(search_value) == "" || jQuery.trim(search_value) == "Enter Keywords") {
                                alert("Please enter some keywords");
                                return false;
                }
                form.submit();
}
