/*
/ **************************************************************************
/
/ System :  SHL, P41 Phase4 
/ Copyright (c) 2003 SHL Group. All rights reserved.
/		
/ $Workfile: codesrc.js $
/ $Date: 15/06/09 11.30a $
/ $Revision: 4 $
/
/
/ Phase 3 Version History:
/ Ver    Date           Author          Comments
/ $Log: /Phase 4/Development/Release1/WebPages/ClientInterface/JavaScript/codesrc.js $
/
*****************************************************************
*/

var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var version;

       
if (browserVer >= 3) 
	version = "n3";
else 
	version = "n2";               


  onerror=exfoerr
  function exfoerr()
  {
      return true;
  }

function flip (imageID,objectName) {
	if (version == "n3") 
	{
		
	}
}

function getCookieVal(offset) {
    try
    {
         var endstr = document.cookie.indexOf (";", offset);
         if (endstr == -1)
			   endstr = document.cookie.length;
         return unescape(document.cookie.substring(offset, endstr));
     }
	catch(e)
	 {
	 }
}

function GetCookie(name) {
	try
	{
		 var arg = name + "=";		 
		 var alen = arg.length;
		 
		 var clen = document.cookie.length;		 
		 var i = 0;

		 while (i < clen) 
		 {
			 var j = i + alen;
			  if (document.cookie.substring(i, j) == arg)
			  return getCookieVal (j);
			  i = document.cookie.indexOf(" ", i) + 1;
			  if (i == 0)
			 break;
 		 }
		return null;
	}
	catch(e)
	{
	}
		
   
}

function CookieBlast() 
{
	try
	{
		var NameString = GetCookie('CNameID');
		if (NameString == null)
			NameString = "WebSurfer";
		 	document.write(NameString);
	}
	catch(e) 
	{
	}
}


function delCookie(name) 
{   
	try
	{
		var expireNow = new Date();
		document.cookie = name + "=" + 	"; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";    		
	}
	catch(e)
	{
	}
}

function confirmAction(sMessage, sUrl)
{
	if(confirm(sMessage))
	{
		window.location = sUrl
	}
}

function confirmActionRev(sMessage, sUrl)
{
	if(!confirm(sMessage))
	{
		window.location = sUrl
	}
}

function urlAlert(sMessage, sUrl)
{
	alert(sMessage);
	window.location = sUrl;
}

function toggleMenu(objID1,objID2,objID3 ) 
	{
		try
		{
			if (!document.getElementById) return;    

			var ob1 = document.getElementById(objID1).style;
			ob1.display = (ob1.display == 'block' || ob1.display == '')?'none': 'block';
			
			var ob2 = document.getElementById(objID2).style;
			ob2.display = (ob2.display == 'block' || ob2.display == '')?'none': 'block';
			
			var ob3 = document.getElementById(objID3).style;
			ob3.display= ( ob2.display=='block' || ob2.display == '')?'none':'block';	
		}
		catch(e)
		{
		}
	}
  	
  window.onresize = ResizeCentContent;
  window.onfocus = ResizeCentContent;
    
 var isMinWidthSet = 0;
  
function ResizeCentContent()
{
  
	  var centContentDiv = document.getElementById('cent_content');
	  var wrapper = document.getElementById('wrapper');
	  try
	  {
		  var helpLink = document.getElementById('helpLink');
	  }
	  catch(e)
	  {
	  }
	  var logoutLink = document.getElementById('logout');
	  
	  if (isMinWidthSet == 0)
	  {

		wrapper.style.width =  centContentDiv.clientWidth  + 180 + 95 + 50;
		wrapper.style.minWidth =  centContentDiv.clientWidth  + 180 + 95 + 50;
		centContentDiv.style.width = document.body.clientWidth - 180 - 95 - 50;
		try
		{
			helpLink.style.left = wrapper.clientWidth - helpLink.clientWidth - logoutLink.clientWidth - 52;
		}
		catch(e)
		{
		}
		isMinWidthSet = 1;
	  }
	  else
	  {
		centContentDiv.style.width = document.body.clientWidth - 180 - 95 - 50;
		wrapper.style.width =  centContentDiv.clientWidth  + 180 + 95 + 50;
		try
		{
			helpLink.style.left = wrapper.clientWidth - helpLink.clientWidth - logoutLink.clientWidth - 52;
		}
		catch(e)
		{
		}
	  }
}

