
/** Library.js **/



function toggle_tabs(src_link, tab_class) {
	var i;
	var class_array;
	
	class_array = $$('li.'+tab_class);
	
	for(i = 0; i < class_array.length; i++)
	{
		class_array[i].setAttribute("id", "");
	}

	$(src_link).parentNode.setAttribute("id", "current");
	
}


function change_gallery_image(target) {

	var location = user_location;

	$('main_photo').setAttribute("src", location+target);

}




/**
/** enable_focus_blur() finds inputs with the 'focus_blur' classname and adds event listeners **/
function enable_focus_blur(){
	var inputs;
	if(!document.getElementById || !document.getElementsByTagName) return;

	inputs = document.getElementsByTagName("input");
		
	for(var i = 0; i < inputs.length; i++)
	{
	
		if(inputs[i].getAttribute("class") != null)
		{
		
			var temp_class = inputs[i].getAttribute("class").split(" ");
		
			if (temp_class.toString().indexOf('focus_blur')!==-1 || temp_class.toString().indexOf('focus_blur_on')!==-1 )
			{

				//add focus event listener to input field
				inputs[i].addEventListener('focus',function ()
				{
				
					temp_class = this.getAttribute("class").split(" ");
									
					var new_class_array = new Array();
				
					for(j = 0; j < temp_class.length; j++){
					
						if(temp_class[j] != 'focus_blur'){
						
							new_class_array[j] = temp_class[j];
						
						}
					
					}
					
					new_class_array[new_class_array.length + 1] = 'focus_blur_on';
					
					var new_class = new_class_array.join(" ");

					this.className=new_class;
				
				},false)



				//add blur event listener to input field
				inputs[i].addEventListener('blur',function () {

					temp_class = this.getAttribute("class").split(" ");
				
					var new_class_array = new Array();
				
					for(j = 0; j < temp_class.length; j++){
					
						if(temp_class[j] != 'focus_blur_on'){
						
							new_class_array[j] = temp_class[j];
						
						}
					
					}
										
					var new_class = new_class_array.join(" ");
										
					this.className=new_class;

				
				},false)
			
			}
		
		}	
		
	}
	
}

/***************************/
