// Globya User Interface v1.0
// Gloya General JS

	/**
	* Search Input value checker 
	*/
	function gl_search_input( ob, def, cn, ca ){
		if( !ob ) return;
		
		var search_input_default_value = def;
		var search_input_default_class = cn;
		var search_input_active_class = ca;
		
		ob.onfocus = function(e){
			if( this.value == search_input_default_value ){
				this.value = '';
			}
			
			this.className = search_input_active_class;
		}
		
		ob.onblur = function(e){
			if( this.value == '' ){
				this.value = search_input_default_value;
				this.className = search_input_default_class;
			}else{
				this.className = search_input_active_class;	
			}			
		}
	}
	
	
	var seperator_banner_id = false;
	
	function gl_seperator_banner( obs, r ){
		if( !obs ) return;
		if( !document.getElementById( obs ) ) return;
		
		seperator_banner_id = obs;
		var ob = document.getElementById( obs );
		var seperator_banner_time = false;
		var seperator_banner_remove = r;
		
		var att_to_small = { height: { to: 0 } };
		var anim_to_small = new YAHOO.util.Anim( obs, att_to_small, 0.5, YAHOO.util.Easing.easeOutStrong);
		ob.inner_remove = seperator_banner_remove;
		
		
		
		anim_to_small.onComplete.subscribe(function(s, o) {	
			this.myob.style.display = "none";
			if( this.myob.inner_remove ){
				this.myob.innerHTML = '';
			}
		});
		
		anim_to_small.myob = ob;
		
		ob.anim_small = anim_to_small;
		
		ob.starthide = function(){
			this.anim_small.animate();
			/*
			h = parseInt( this.style.height );
			if( 0 < h ){
				if( 0 > (h -5) ){ 
					h = 0;
				}else{
					h -= 5;
				}
				this.style.height = h + "px";
				seperator_banner_time = setTimeout( "document.getElementById( '" + seperator_banner_id + "' ).starthide();", 1 );
			}else{
				this.style.height = "0px";
				if( seperator_banner_remove ){
					this.innerHTML = '';
				}
				this.style.display = "none";
				if( window.seperator_banner_time ) clearTimeout( seperator_banner_time );
			}
			*/
		}
	}
	
	function GLHIDEBANNER(){
		if( document.getElementById( seperator_banner_id ) ){
			document.getElementById( seperator_banner_id ).starthide();
		}
		return;
	}
	
	
	function gl_quick_links_displayer( obs, minh, maxh ){
		if( !obs ) return;
		if( !document.getElementById( obs ) ) return;
		
		var quick_links_id = obs;
		var ob = document.getElementById( obs );
		var quick_links_time = false;
		var quick_links_minh = minh;
		var quick_links_maxh = maxh;
		
		var att_to_big = { height: { to: quick_links_maxh } };
		var att_to_small = { height: { to: quick_links_minh } };
		
    	var anim_to_big = new YAHOO.util.Anim( obs, att_to_big, 1, YAHOO.util.Easing.elasticOut  );
    	var anim_to_small = new YAHOO.util.Anim( obs, att_to_small, 1, YAHOO.util.Easing.elasticOut  );

    	ob.anim_big = anim_to_big;
    	ob.anim_small = anim_to_small;
    	
		ob.starthide = function( n ){
			if( n ){
				clearTimeout( quick_links_time );
			}
			
			this.anim_small.animate();
			/*
			h = parseInt( this.style.height );
			if( quick_links_minh < h ){
				if( quick_links_minh > (h -5) ){ 
					h = quick_links_minh;
				}else{
					h -= 5;
				}
				this.style.height = h + "px";
				quick_links_time = setTimeout( "document.getElementById( '" + quick_links_id + "' ).starthide();", 1 );
			}else{
				this.style.height = quick_links_minh + "px";
				clearTimeout( quick_links_time );
			}
			*/
		}
				
		ob.onmouseover = function(){
			clearTimeout( quick_links_time );
			
			this.anim_big.animate();
			
			/*
			if( !quick_links_maxh || quick_links_maxh == "undefined" ){
				this.style.height = "auto";	
			}else{
				this.style.height = quick_links_maxh + "px";
			}
			*/
		}
		
		ob.onmouseout = function(){
			clearTimeout( quick_links_time );
			
			quick_links_time = setTimeout( "document.getElementById( '" + quick_links_id + "' ).starthide(true);", 5000 );
		}
	}