function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function setCookie (name, value) {
         var argv = setCookie.arguments;
         var argc = setCookie.arguments.length;
         var expires = (argc > 2) ? argv[2] : null;
         var path = (argc > 3) ? argv[3] : null;
         var domain = (argc > 4) ? argv[4] : null;
         var secure = (argc > 5) ? argv[5] : false;
         document.cookie = name + "=" + escape (value) +
         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
         ((path == null) ? "" : ("; path=" + path)) +
         ((domain == null) ? "" : ("; domain=" + domain)) +
         ((secure == true) ? "; secure" : "");
}
function go(location){
  window.location="/servlet/ContentServer?pagename=cif/europe/"+globalUserType+"/page&assetName="+trim(location);
}
function trim(str){
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function swapImage(theImgName,theImgObj){
   if(document.images){
     document.images[theImgName].src = theImgObj.src;
     }
   }
function showLink(el) {
   var msg = "Inactive link for development...\n\nLink to: " + el;
   alert(msg);
   }
   
function checkResize()
{
	var NS = (document.all) ? 0 : 1;
	if ( NS )
		location.reload();
}

function doSubmit(f){
     showLink(f.name);
     return false;
     }
	  
// from Usability Testing 
function popUp() {
	win = open('popUp.jsp', 'privacy', 'toolbar=no,menubar=no,location=no,resizable=yes,width=600,height=350,left=150,top=20')
	win.focus()
	//return false
}

function isBlank(s)
{
	if((s == null) || (s == ""))
		return(true);
	
	for(var i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if((c != ' ') && (c != '\n') && (c != '\t'))
			return(false);
	}	
	return(true);
}
      
function checkEmail(field)
{
	pattern = new RegExp('[^ \\(\\)\\<\\>\\[\\]@,;:"\'\\\\]+[@][^ \\(\\)\\<\\>\\[\\]@,;:"\'\\\\]+(\\.[^ \\(\\)\\<\\>\\[\\]@,;:"\'\\\\]+)+',"i");
	return(field.match(pattern));
}


function doBack() {
    window.history.back();
}

