

//Always Run

//setStatusBar("SynergyCMS 2005");
//disableRightClick();

//End Always run


//Misc

/*
function disableRightClick(e)
{
    
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
       return false;
    }
  }
  else
  {
      return false;
  }
}


function setStatusBar(text){
	window.status=text;

}



*/




//Window calling functions


function OpenDialogWindow(url,windowname){
    var props = "status=no";
	var location =  url 
	//window.open(location,"", props);

	var win = showModalDialog(location,"",props); 
	
}


function OpenChildWindow(url,width,height){

	var left = (screen.width/2) - (width/2) -60;
	var top = ((screen.height/2) - height/2) -45; //25px more to the top

    var props = "width=" + width +  ",height="  + height +  ",scrollbars=no,status=yes,toolbar=no,titlebar=no,menubar=no,left=" +left+",top="+top+"'";
	var location =  url 
	return (window.open(location,"", props));

}


function OpenChildWindowWithScroll(url,width,height){

 

	var left = (screen.width/2) - (width/2) -60;
	var top = (screen.height/2)- (height/2) -45; //25px more to the top

    var props = "width=" + width +  ",height="  + height +  ",scrollbars=yes,status=yes,toolbar=no,titlebar=no,menubar=no,left=" +left+",top="+top+"'";
	var location =  url 
	return (window.open(location,"", props));

}

function OpenChildWindowResizable(url,width,height){

 

	var left = (screen.width/2) - (width/2) -60;
	var top = (screen.height/2)- (height/2) -45; //25px more to the top

    var props = "width=" + width +  ",height="  + height +  ",scrollbars=yes,resizable=yes,status=yes,toolbar=no,titlebar=no,menubar=no,left=" +left+",top="+top+"'";
	var location =  url 
	return (window.open(location,"", props));

}

function OpenChildWindowResizableWithMenu(url,width,height){

 

	var left = (screen.width/2) - (width/2) -60;
	var top = (screen.height/2)- (height/2) -45; //25px more to the top

    var props = "width=" + width +  ",height="  + height +  ",scrollbars=yes,resizable=yes,status=yes,toolbar=no,titlebar=no,menubar=yes,left=" +left+",top="+top+"'";
	var location =  url 
	return (window.open(location,"", props));

}


function OpenChildWindowSingle(url,name,width,height,winObj){

		//call to open single window .. if already open set the focus to the window

		// first check to see if the window already exists
		if (winObj != null)
		{
			// the window has already been created, but did the user close it?
			// if so, then reopen it. Otherwise make it the active window.
			if (!winObj.closed) {
			winObj.focus();
			return winObj;
			} 
			// otherwise fall through to the code below to re-open the window
		}

		var left = (screen.width/2) - (width/2) - 60;
		var top = ((screen.height/2) - height/2) -45; //25px more to the top

		var props = "width=" + width +  ",height="  + height +  ",scrollbars=no,status=yes,toolbar=no,titlebar=no,menubar=no,left=" +left+",top="+top+"'";
		var location =  url;
		
		return (window.open(location,"", props));
}







//END Window calling functions





//Cookie Functions

function set_Cookie(key,value) {
	var e =  new Date(2100,0,1); 
    document.cookie = key + "=" + value + "; path=/; expires=" + e.toGMTString();
}


function read_Cookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	
	for(var k=0;k < ca.length;k++)
	{
		var c = ca[k];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//END CookieFunctions

