	window.onload = function(){
		
		work_lists = document.getElementsByTagName("select");
		
		for( i=0; i < work_lists.length; i++ ){
			
			if( work_lists[i].name == "search_category" ){ 
				my_div = document.getElementById("selected_drop_text"); my_div.innerHTML = work_lists[i].options[work_lists[i].selectedIndex].text; 
				my_hidden = document.getElementById( "search_category_value" );
				my_hidden.value = work_lists[i].options[work_lists[i].selectedIndex].text;
			}
	
		}
		
		// opacity
		select_list = document.getElementsByName("search_category");
		if( select_list && select_list[0] ){
			select_list[0].style.opacity = 0;
			select_list[0].style.filter = 'alpha(opacity=0)';
		}
				
	}
	
	
	/*
		changecssclass( what_select, what_class, add )
		- change css class
	*/
	function changecssclass( what_select, what_class, add ){	
		if( add ){ what_select.className = what_select.className + " " + what_class; }
		else { what_select.className = what_class; }		
	}


	/*
		function UpdateSelectedText( what_list, what_div_id )
		- update div text
	*/
	function UpdateSelectedText( what_list, what_div_id ){
		
		work_list = document.getElementsByName( what_list );
		work_div  = document.getElementById( what_div_id );
		
		work_div.innerHTML = work_list[0].options[work_list[0].selectedIndex].text;
		
		my_hidden = document.getElementById( "search_category_value" );
		my_hidden.value = work_list[0].options[work_list[0].selectedIndex].text;
		
	}
	
	
	/*
		function InputFocus( parent_div , input_element )
		- change parent div css class , whan input gets focus
	*/
	function InputFocus( parent_div , input_element, do_reset ){
		if( (typeof(do_reset) == "number") && (do_reset == 0) ) do_reset = 0; else do_reset = 1;
		main_element = document.getElementById(parent_div);
		ResetInputValue( main_element, input_element, do_reset);
	}
	
	
	/*
		- reset value in input field
		- change parent div css class
	*/
	function ResetInputValue( main_element, input_element, do_reset ){
		if( (typeof(do_reset) == "number") && (do_reset == 0) ) do_reset = 0; else do_reset = 1;

		my_element 	= document.getElementsByName(input_element);

		if( my_element.length == 1 ){
			
			my_element 	= my_element[0];
			
			// value from input
			old_input_value  = my_element.value;
			if( do_reset ) my_element.value = '';

			// change css class - div
			old_div_cssclass = main_element.className;
			old_div_cssclass = old_div_cssclass.split(" "); 
			old_div_cssclass = old_div_cssclass[0].split(","); 
			old_div_cssclass = old_div_cssclass[0];
			main_element.className = old_div_cssclass + " " + old_div_cssclass + '_on';
			
			// focus on input
			setTimeout ( 'my_element.focus();', 200 );

			my_element.onblur = function(){ 
				if( do_reset ) { if( my_element.value == "" ){ my_element.value = old_input_value; } }
				main_element.className 	= old_div_cssclass;
			}
			
		}

	}
	
	
	/*
		- switch latest activites box
	*/
	function LatestBox( element_link, element_div ){
		
		// get switch links
		switch_links = document.getElementById("latest_activities_bar").getElementsByTagName("A");
		
		// reset css classes ( removes active class )
		ResetCssClasses(switch_links);
		
		// set active class on clicked link (element_link)
		element_link.className = 'active';
		
		// hide all divs in "lastest_box"
		HideAllSwitchDivs();
		
		// show selected div
		if( selected_div = document.getElementById(element_div) ){ 
			
			// set opacity = 0
		 	setOpacity( element_div, 0 );

			selected_div.style.display = 'block'; 

			// fade in
			ElementFadeIn( element_div );
			
		}
		
	}
	
	
	
	/*
		- reset css classes in all links in "links_collection"
	*/
	function ResetCssClasses( links_collection ){
		for( i = 0; i < (links_collection.length); i++ ){ links_collection[i].className = ''; }
	}
	
	/*
		- hide 4 switch divs
	*/
	var myDivs = new Array( "switch_pet_photos" ,"switch_pet_videos" , "switch_yellow_pages", "switch_comunity" );
	function HideAllSwitchDivs(){
		for( i = 0; i < (myDivs.length); i++ ){
			my_temp_div = document.getElementById(myDivs[i]);
			my_temp_div.style.display = 'none';
		}
	}
	
	/*
		- sets opacity on an element
	*/
	function setOpacity( element, value ) {
		if( my_element = document.getElementById(element) ){
			my_element.style.opacity = value/10;
		 	my_element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + value * 10 + ");";
			//my_element.style.filter = 'alpha(opacity=' + value*10 + ')';		
		}
	}
		
	
	/*
		- fade in function
	*/
	loop_steps 		= 10;
	start_opacity 	= 0;
	end_opacity		= 10;
	opacity_step	= 1;
	timeout			= 50;
	timeout_speed	= 20;
	current_opacity = start_opacity;
	
	function ElementFadeIn( element_id ){

		current_timeout = timeout;

		if( my_element = document.getElementById(element_id) ){
			for( i = 0; i <= loop_steps; i++ ){
				current_opacity = start_opacity + ( opacity_step * i );
				current_timeout += timeout_speed;
				setTimeout("setOpacity( '"+element_id+"', "+current_opacity+" );",current_timeout);
				
			}
		}
		
	}
	
	
	/*
		function SubmitFormPhotoUpload()
		- check pet photo upload form and submit
	*/
	function SubmitFormPhotoUpload(){
		
	   check_empty = "";
	
	   if (document.pet_photo_upload_form.photo_title.value == "") 	check_empty = check_empty + "\n- Title";

	   if( !document.getElementsByName('edit_photo').length ){ if (document.pet_photo_upload_form.userfile.value == "") 	check_empty = check_empty + "\n- File"; }
	   if (check_empty != ""){ alert("Please fill in:" + check_empty); }
	   else { document.pet_photo_upload_form.submit(); }
		
	}
	
	
	/*
		function SubmitFormVideoUpload()
		- check pet video upload form and submit
	*/
	function SubmitFormVideoUpload(){
		
	   check_empty = "";
	
	   if (document.pet_video_upload_form.video_title.value == "") 	check_empty = check_empty + "\n- Title";
	   if( !document.getElementsByName('edit_video').length ){ if (document.pet_video_upload_form.userfile.value == "") 	check_empty = check_empty + "\n- Video File"; }
	   if (check_empty != ""){ alert("Please fill in:" + check_empty); }
	   else { document.pet_video_upload_form.submit(); }
		
	}
	
	
	/*
		function SubmitFormYPUpload()
		- check yp upload form and submit
	*/
	function SubmitFormYPUpload(){
		
	   check_empty = "";
	
	   if (document.pet_yp_upload_form.yp_title.value == "") 	check_empty = check_empty + "\n- Title";
	   if (document.pet_yp_upload_form.yp_desc.value == "") 	check_empty = check_empty + "\n- Description";
	   if (check_empty != ""){ alert("Please fill in:" + check_empty); }
	   else { document.pet_yp_upload_form.submit(); }
		
	}
	
	
	/*
		function navigation_photo_jump()
		- jump to image number
	*/
	function navigation_photo_jump(){
		
		if( (work_form = document.getElementById('photo_detail_nav')) && (nav_page = document.getElementById('nav_page')) ){

			what_page = nav_page.value;
			if( !isNaN(parseInt(what_page)) ){
				if (typeof jumpArray_photos[what_page-1] != 'undefined'){
					if( jumpArray_photos[what_page-1] != 0 ){ 

						// submit form
						new_form_action = work_form.action;
						work_form.action = new_form_action + jumpArray_photos[what_page-1] + '/';
						
						work_form.submit();
						
					}
				}
				
			}
			
			
		}
		
	}
	
	
	/*
		function navigation_yp_jump()
		- jump to yp number
	*/
	function navigation_yp_jump(){
		
		if( (work_form = document.getElementById('yp_detail_nav')) && (nav_page = document.getElementById('nav_page')) ){

			what_page = nav_page.value;
			if( !isNaN(parseInt(what_page)) ){
				if (typeof jumpArray_yps[what_page-1] != 'undefined'){
					if( jumpArray_yps[what_page-1] != 0 ){ 

						// submit form
						new_form_action = work_form.action;
						work_form.action = new_form_action + jumpArray_yps[what_page-1] + '/';
						
						work_form.submit();
						
					}
				}
				
			}
			
			
		}
		
	}
	
	
	/*
		function navigation_video_jump()
		- jump to video number
	*/
	function navigation_video_jump(){
		
		if( (work_form = document.getElementById('video_detail_nav')) && (nav_page = document.getElementById('nav_page')) ){

			what_page = nav_page.value;
			if( !isNaN(parseInt(what_page)) ){
				if (typeof jumpArray_videos[what_page-1] != 'undefined'){
					if( jumpArray_videos[what_page-1] != 0 ){ 

						// submit form
						new_form_action = work_form.action;
						work_form.action = new_form_action + jumpArray_videos[what_page-1] + '/';
						
						work_form.submit();
						
					}
				}
				
			}
			
			
		}
		
	}
	
	
	/*
		submit form , with comment id
	*/
	function LoadComment( current_url , comment_id ){
		
		id_comment_placeholder 	= 'comment_box_placeholder';
		
		comment_html = '<form action="'+current_url+'#commentbox" name="comment_edit_form" id="id_comment_form" method="POST"><input type="hidden" name="load_comment" value="' + comment_id + '"></form>';
		if( comment_placeholder = document.getElementById(id_comment_placeholder) ){
			
		comment_placeholder.innerHTML = comment_html;
		if( edit_form = document.getElementById('id_comment_form') ){
			edit_form.submit();
		}
			
		}

	}
	
	
	/*
		function ShowCommentBox( what_comment_type )
		- show comment box
	*/
	function ShowCommentBox( what_comment_type ){
		
		id_comment_placeholder 	= 'comment_box_placeholder';
		id_comment_ta			= 'comment_ta';
		
		comment_html = '<form action="" name="comment_form" id="id_comment_form" method="POST"><div class="comment_wrapper"><textarea id="'+id_comment_ta+'" name="comment" class="comment_ta"></textarea><a href="#" onclick="document.forms[\'comment_form\'].submit(); return false;" id="contact_submit_button"></a></div><input type="hidden" name="newcomment" value="1"></form>';

		if (typeof what_comment_type != 'undefined'){
			if( comment_placeholder = document.getElementById(id_comment_placeholder) ){
				
				switch( what_comment_type ){
					
					case "petphoto":
					case "petvideo":
					case "yellowpages":
						if( comment_placeholder.innerHTML == "" ){ comment_placeholder.innerHTML = comment_html; }
						if( comment_box = document.getElementById(id_comment_ta) ){ setTimeout ( 'comment_box.focus();', 200 );	 }
						break;
						
						
					default: break;
					
				}
				
			}
		}
			
	}
	
	
	/*
		function NavigationJump( current_url )
		- jump to page
	*/
	function NavigationJump( current_url ){
		
		jump_element_id = 'jump_page';
		
		if( current_url && (what_page_element = document.getElementById(jump_element_id))){
			element_value = parseInt(what_page_element.value);
			if( !isNaN(element_value) && ( element_value != 0 ) ) {
				location.href = current_url + element_value + '/';
			}
		}
		
	}
	
	
	/*
		function AddNewStaticPage()
		- admin function, add new static page
	*/
	function AddNewStaticPage(){
		
		prazno = "";
		
		if (document.static_page_form.static_page_title.value == "") prazno = prazno + "\n- Page title";
		if (prazno != "") {
		  alert("Please fill in: \n" + prazno)
		  return false;
		}
		else document.forms['static_page_form'].submit();
		
	}
	
	
	/*
		function ValidateContact()
		- validate contact form
	*/
	function ValidateContact(){
		
		prazno = "";
		
		if (document.contact_form.contact_name.value == "") prazno = prazno + "\n- Your name";
		if (document.contact_form.contact_email.value == "") prazno = prazno + "\n- Your email";
		if (document.contact_form.contact_subject.value == "") prazno = prazno + "\n- Subject";
		if (document.contact_form.contact_message.value == "") prazno = prazno + "\n- Message";
		if (prazno != "") {
		  alert("Please fill in: \n" + prazno)
		  return false;
		}
		else document.forms['contact_form'].submit();
		
	}
	
	
	/*
		function GetStaticUrl( prompt_url )
		- alert static url
	*/
	function GetStaticUrl( prompt_url ){
		
		var reply = prompt("Static page url", prompt_url, '');

		
	}
	

