function showMemberList(cookie,id,url)
{	
	var testArray = new getCookieArray(cookie);
	strList=id+"="+testArray[0];
		
	for(i=1;i<testArray.length;i++)	
	 {	
		strList+="|";
		strList+=testArray[i]; 
	 }	
	window.open(url + "&" + strList, "listwin", "addressbar=no,status=no,scrollbars=yes,toolbar=no,resize=yes,location=no,menu=no,width=780,height=700,left=10,top=10");
	return true;
}

function delete_cookie(c_name)
{
	var c_date = new Date();  // current date & time
	c_date.setTime ( c_date.getTime() - 1000 * 60 * 60 * 24 );
	document.cookie = c_name + "=; expires=" + c_date.toGMTString() + ";path=/";
	return true;
}

function isDuplicate(c_value,c_name){
	var testArray = new getCookieArray(c_name);
	for(i=0;i<=(testArray.length);i++){
		if(testArray[i]==c_value)
		{
			return true;
		}
	}
	return false;
}

function setCookieVal(c_name,cookieValue) {
	if(isDuplicate(cookieValue,c_name)) return;

	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 60000*20);//expire cookie after 20 mins of last added emp. in the list
	if(getCookie(c_name)==null)
	  {
		  document.cookie = c_name+"=" + escape(cookieValue+'|')
			 + ";expires=" + expire.toGMTString() + ";path=/";
	  }
	 else
	  {
		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
			cookieOldValue = unescape(document.cookie.substring(c_start,c_end));
			cookieOldValue +=cookieValue +'|'; 
			document.cookie = c_name+"=" + escape(cookieOldValue)
			 + "; expires=" + expire.toGMTString() + "; path=/";
		}

	  }
}

function addToList(empid,cname){
	setCookieVal("emplist",empid);		
	alert(cname + ' has been added to your Mail List. \n\n After adding employers to your mail list, \n Click on Send Mails Now, to send mails to all the employers in the selection list\n\nYou can Add Employers to the List without Registration, but Registration is required before you actually Send the Mails.');
}

function addJobToList(jobid,candesg){
	setCookieVal("joblist",jobid);		
	alert(candesg + ' has been added to your Mail List. \n\n After adding jobs to your mail list, \n Click on Send Mails Now, to send mails to all the jobs in the selection list\n\nYou can Add Jobs to the List without Registration, but Registration is required before you actually Send the Mails.');
}

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 null
}

function getCookieArray(c_name)
{
 var i = 0;
 if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
	{ 
		c_start=c_start + c_name.length 
		c_end=document.cookie.indexOf(";",c_start)
		if (c_end==-1) c_end=document.cookie.length
		cookieValue = unescape(document.cookie.substring(c_start,c_end));
		c_start=1;
		c_end=cookieValue.indexOf("|",c_start)
		while (c_end!=-1) {
			this[i] = cookieValue.substring(c_start,c_end);
			i++; this.length = i; 
			c_start=c_end+1;
			c_end=cookieValue.indexOf("|",c_start)
		}
	} 
  }
return null

}