function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
} 
function smartSHhandling(imgID,imgPath){
	
	var idSH=getCookie('smartSH');
	if(idSH!=null && idSH!=""){
		
		var imgNumID=idSH.split("-");
		document.getElementById(imgID+imgNumID[1]).src = imgPath+'minus.gif'
		
		document.getElementById(idSH).style.display = 'block'
	}
}
function showHide(inID,Dsply) {

	if(Dsply=="s"){

		document.getElementById(inID).style.display = 'block';

	}
	else if(Dsply=="h"){

		document.getElementById(inID).style.display = 'none';

	}
	else{

		document.getElementById(inID).style.display = 'block';

	}	

}

function setCookie(c_name,value,expiredays){
	
	var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	
	/*+
	(";path=/")+
	(";domain="+ document.domain);*/
}

function SmartShowHide(inID,WithCookie) {
	 
	 if (document.getElementById(inID).style.display == 'none' || document.getElementById(inID).style.display == '') {

		document.getElementById(inID).style.display = 'block';
			
		if(WithCookie==true){
			setCookie('smartSH',inID,1);
     	}
     
	 } else {
          
		document.getElementById(inID).style.display = 'none';

		if(WithCookie==true){
			setCookie('smartSH',inID,-0);
     	}
		  
     }
     
}

function changeImg(whatID,path){
	
	var what=document.getElementById(whatID);
	
	if(what.src == path+'minus.gif'){
		
		what.src = path+'plus.gif'
	}
	else{
		
		what.src = path+'minus.gif'
	}
}

function changeManImg(whatID,path,imgName1,imgName2)
{
	var what=document.getElementById(whatID);

	if(what.src == path+imgName2)
	{
		what.src = path+imgName1;
	}
	else
	{
		what.src = path+imgName2
	}
}

var alertTimerId = 0;

function alertTimerClickHandler ( )
{
  if ( document.getElementById("alertTimerButton").value == "Click me and wait!" )
  {
    // Start the timer
    document.getElementById("alertTimerButton").value = "Click me to stop the timer!";
    alertTimerId = setTimeout ( "showAlert()", 3000 );
  }
  else
  {
    document.getElementById("alertTimerButton").value = "Click me and wait!";
    clearTimeout ( alertTimerId );
  }
}

function showAlert ( )
{
  alert ( "Too late! You didn't stop the timer." );
  document.getElementById("alertTimerButton").value = "Click me and wait!";
}

function hideGroupsDescr(vissible_ID,all_IDS,pref) {

	
	hiddensIDS=all_IDS.split(',');

	for(i=1;i<hiddensIDS.length;i++)
		if(hiddensIDS[i]!=vissible_ID)
			document.getElementById(pref+hiddensIDS[i]).style.display = 'none';
		else
			document.getElementById(pref+hiddensIDS[i]).style.display = 'block';
}
