/*************************************************************/
/******************* functions .js *****************************/
/*************************************************************/



//************************************************************
// Scroll Pos 

	function getScrollPos() {
		var scrOfY = 0;
	
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;				
		} else if( document.body && document.body.scrollTop  ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;				
		} else if( document.documentElement && document.documentElement.scrollTop ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;				
		}
		return scrOfY;
	}



//************************************************************
// Popup 


	function hald_openwin(myfile,width,height){
		if( !width ) width = 400;
		if( !height ) height = 400;
		var now=new Date()
		winname="a" + now.getTime()
		params = "width="+width+",height="+height+",resizable=1,status=1,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0 ";
		newwin = window.open( myfile, winname , params)
		if( window.focus ) newwin.focus();
	}
	
	function hald_openwinfix(myfile,width,height){
		if( !width ) width = 400;
		if( !height ) height = 400;
		var now=new Date()
		winname="a" + now.getTime()
		params = "width="+width+",height="+height+",resizable=0,status=1,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0 ";
		newwin = window.open( myfile, winname , params)
		if( window.focus ) newwin.focus();
	}
	
	
//************************************************************
/* show div */

	function showdiv(sIDshow, sIDhide) {
	
		if ( sIDshow != '') {
			document.getElementById(sIDshow).style.display = "block";
		}
		
		if ( sIDhide != '') {
			document.getElementById(sIDhide).style.display = "none";
		}
	
	}
	

	
	

//***********************************************************
/* Switch Element */
	
	function switchElement(sID) {
	
		if ( sID != null)
		{
			if ( document.getElementById(sID).style.display == "none" )
			{
				document.getElementById(sID).style.display = "block"	
			}else
			{
				document.getElementById(sID).style.display = "none"	
			}
		}
	
	}
	
	

//***********************************************************
/* Switch Element */
	
	function fadeElement( sID ) {
	
		if ( sID != null)
		{
			if ( document.getElementById(sID).style.display == "none" )
			{
				$("#"+sID).fadeIn(1000);	
			}else
			{
				$("#"+sID).fadeOut(1000);
			}
		}
	
	}
	


//***********************************************************
/* Switch Element */
	
	function fadeElementBG( sID ) {
	
		if ( sID != null )
		{
			if ( document.getElementById(sID).style.display == "none" )
			{
				$("#"+sID).show();
				$("#"+sID).css('opacity', 0);	
				$("#"+sID).fadeTo(1000, 0.8);	
			}else
			{
				$("#"+sID).fadeOut(1000);
			}
		}
	
	}
	


//***********************************************************
/* Switch Element */
	
	function fadeElementImageMovie( sID, sIDMovie, sPathMovie ) {
	
		if ( sID != null)
		{
			if ( document.getElementById(sID).style.display == "none" )
			{
				$("#"+sID).fadeIn(700, function() {
					loadImageMovie(sIDMovie, sPathMovie);							 
				});	
			}else
			{
				$("#"+sID).fadeOut(1000);
			}
		}
	
	}
	


//***********************************************************
/* load/unload ImageMovie */

	function loadImageMovie(sID,sPath) 
	{		
		if (sID != null && sPath != null )
		{			
			document.getElementById(sID).src = sPath;
		}
	}

