/*	-------------------------------------------------------------
	Environmental Center for Arab Towns Website
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Common Scripts / Functions
	Filename:		common.js
	Version:		1.0
	Date:			Feb 07, 2005
	-------------------------------------------------------------	*/
		
	<!--

	function getCookie(CookieName) {
		var start = document.cookie.indexOf(CookieName + '=');
		var len = start + CookieName.length + 1;
		if ((!start) && (CookieName != document.cookie.substring(0,CookieName.length)))
			return null;
		if (start == -1)
			return null;
		var end = document.cookie.indexOf(';',len);
		if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(len,end));
	}

	function setCookie(CookieName,value,expires,path,domain,secure) {
		document.cookie = CookieName + "=" +escape(value) +
		( (expires) ? ";expires=" + expires : "") +
		( (path) ? ";path=" + path : "") + 
		( (domain) ? ";domain=" + domain : "") +
		( (secure) ? ";secure" : "");
	}

	function deleteCookie(CookieName,path,domain) {
		if (getCookie(CookieName))
			document.cookie =
			CookieName + '=' +
			( (path) ? ';path=' + path : '') +
			( (domain) ? ';domain=' + domain : '') +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
	//-->

	<!--
	var g_USER_AGENT = getAgent();
	
	// return NN4, NN5(Netscape 6+, Mozilla 1+?), IE4, IE5(IE5+), Unknown
	function getAgent(){
	  var userAgent = navigator.userAgent;
	  var charIndex;
	  var majorVersion;
	
	  charIndex = userAgent.indexOf("MSIE");
	  if(charIndex){
		majorVersion = userAgent.charAt(charIndex + 4 + 1);
		if(majorVersion > 4){
		  return("IE5");
		}
		else if(majorVersion == 4){
		  return("IE4");
		}
	  }
	
	  charIndex = userAgent.indexOf("Mozilla");
	  majorVersion = userAgent.charAt(charIndex + 7 + 1);
	  if(majorVersion > 4){
		return("NN5");
	  }
	  else if(majorVersion == 4){
		return("NN4");
	  }
	
	  return("Unknown");
	}
	/* USER_AGENT check end -------------------------------------------------- */
	