function detectBrowser()
{
	var d = document;
	var nav=navigator;
	this.agt=nav.userAgent.toLowerCase();
	this.major = parseInt(nav.appVersion);
	this.ns=(d.layers);
	this.dom=(d.getElementById)?1:0;
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.agt.indexOf("Netscape6")!=-1);
	this.op=(window.opera? 1:0);
	if(d.all)
		this.ie=1;
	else 
		this.ie=0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.gk=(typeof(nav.product)!="undefine"&&nav.product)?1:0;
	this.fb=(this.agt.indexOf("firebird")!=-1);
	this.fx=(this.agt.indexOf("firefox")!=-1);
	this.sf=(this.agt.indexOf("safari")!=-1);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
}
var gBW = new detectBrowser();

var IdList = 0;

function checkBoxCheck(e,id)
{
	if (IdList == 0)
	{
		Highlight(e);
		IdList = id;
	}
	else
	{
		found = -1
		splitIdList = IdList.split(",");
	
		for(i=0; i<splitIdList.length; i++)
		{
			if (splitIdList[i].length > 0 && (splitIdList[i] == id))
			{
				found = i;
			}
		}			

		if (found == -1)
		{
			Highlight(e);
			IdList += "," + id;
		}
		else
		{
			Unhighlight(e);
			IdList = "";
			for(i=0; i<splitIdList.length; i++)
			{
				if ((i != found) && (splitIdList[i].length > 0))
				{
					if (IdList == "")
						IdList = splitIdList[i];
					else
						IdList += "," + splitIdList[i];
				}
			}			
		}
	}

	//window.alert(IdList);
}

function Highlight(e)
{
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
		r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
		r = e.parentElement.parentElement;
	}
	if (r) {
/*		if (r.className == "a") {
			r.className = "b";
		}
		else if (r.className == "b") {
			r.className = "a";
		}
*/		
		r.className = "c";
	}
}

function Unhighlight(e)
{
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
		r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
		r = e.parentElement.parentElement;
	}
	if (r) {
/*		if (r.className == "msgnews") {
			r.className = "msgnew";
		}
	    else if (r.className == "msgolds") {
			r.className = "msgold";
	    }
*/
		r.className = "a";	    
	}
}

function CheckAll(thisdoc)
{
  for (var i=0;i<thisdoc.elements.length;i++)
  {
    var e = thisdoc.elements[i];
    if (e.name != 'SelectAll')
      e.checked = thisdoc.SelectAll.checked;
  }
}

function UnCheckTop(thisdoc)
{
  for (var i=0;i<thisdoc.elements.length;i++)
  {
    var e = thisdoc.elements[i];
    if ((e.type == 'checkbox') && (e.name != 'SelectAll') && (e.name != '') && (e.checked == false))
    {
      thisdoc.SelectAll.checked = false;
      return;
    }
  }
    
  thisdoc.SelectAll.checked = true;
}

function GoForwardEmailWindow()
{
	var url = "forwardEmail.aspx?";
	var hWnd = window.open(url,"EmailList",'width=650,height=500,status=yes,resizable=yes,scrollbars=yes,alwaysRaised=yes,dependent=yes');
	//if ((cdoc.window != null) && (!hWnd.opener))
	//	hWnd.opener = cdoc.window;
	return false;
}

function SubmitEmailList()
{
	var val = "";
	val = document.ForwardEmail.selectedEmailIDList.value;
	window.opener.document.ComposeMail.confirmEmailList.value = val;
	if(window.opener.document.getElementById("iView") != null)
	{
		window.opener.document.getElementById('hiddenContainer').value = window.opener.iView.document.body.innerHTML;
	}
	window.opener.document.ComposeMail.submit();
	window.close();
}



function GoAddressWindow(cdoc,target)
{ 
	var url = "contacts.aspx?target=" + target.toString ();
	url += "&curListTO="  + escape (cdoc.ComposeMail.txtTo.value);
	url += "&curListCC="  + escape (cdoc.ComposeMail.txtCc.value);
	url += "&curListBCC=" + escape (cdoc.ComposeMail.txtBcc.value);

	var hWnd = window.open(url,"contacts","width=675,height=405,resizable=yes,scrollbars=yes");
	hWnd.focus();
	
	if ((cdoc.window != null) && (!hWnd.opener))
		hWnd.opener = cdoc.window;
	return false;
}

function UpdateContacts(domain)
{
	window.opener.document.ComposeMail.txtTo.value  = document.ContactList.txtTO.value;
	window.opener.document.ComposeMail.txtCc.value  = document.ContactList.txtCC.value;
	window.opener.document.ComposeMail.txtBcc.value = document.ContactList.txtBCC.value;

	autoFilling(domain, window.opener.document.ComposeMail.txtTo);
	autoFilling(domain, window.opener.document.ComposeMail.txtCc);
	autoFilling(domain, window.opener.document.ComposeMail.txtBcc);
	
	window.close();
	return(false);
}

function isIE5Browser() {
	var agt = navigator.userAgent;
	var is_ie = (agt.indexOf("MSIE") != -1);
	var ver_no = 0;

	if(is_ie) {
		ver_no = parseFloat(agt.substr(agt.indexOf("MSIE ") + 4, agt.indexOf("; Windows") - agt.indexOf("MSIE ")));
		if(ver_no >= 5) {
			return true;
		} else {
			return false;
		}
	} else {
			return false;
	}
}

function confirmDelete(strmsg)
{
	var newMessage = strmsg;
	var msgLen = newMessage.length;
	var i=0;
	var tmpStr = "";
	
	for(i; i < msgLen; i++){
	
	//this will avoid the '<b></b>' tags to be displayes in the 
	//confirmation boxes in browsers other than IE
		if(newMessage[i] == "<" || newMessage[i] == ">" || newMessage[i] == "/")
			continue;
		else if(newMessage[i] == "B" || newMessage[i] == "U")
			continue;
		else
			tmpStr +=newMessage[i];
	}
	
	if(confirm(tmpStr))
		return true;
	else 
		return false;
}

function printEmail(mailId, header)
{
	window.open("printEmail.aspx?ID=" + mailId + "&header=" + header);
	return false;
}

function notificationBox(strmsg)
{
	if (isIE5Browser() == true)
		window.showModalDialog("confirmBox.aspx?type=notice&MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:170px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(strmsg)
		
	return false;
}

function confirmationBox(strmsg)
{
	var vReturnValue = true;
	window.returnValue = false;
	
	if (isIE5Browser() == true)
	{
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");

	}
	else
		vReturnValue = confirmDelete(strmsg)
		
	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function confirmationBox2(strmsg)
{
	vReturnValue = confirmationBox(strmsg);
	if(vReturnValue==true)
	{
		if(document.ComposeMail.confirmSending != null)
		{
			document.ComposeMail.confirmSending.value = "YES";	
		}
		return true; 
	}
	else 
	{
		if(document.ComposeMail.confirmSending != null)
		{
			document.ComposeMail.confirmSending.value = "NO";	
		}
		return true;
	}
}

function confirmationBox3(strmsg)
{
	var vReturnValue = true;
	window.returnValue = false;
	
	if (isIE5Browser() == true)
	{
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	}
	else
		vReturnValue = confirmDelete(strmsg)
		
	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function confirmationBox4(strmsg)
{
	var vReturnValue = true;
	window.returnValue = false;
	
	if (isIE5Browser() == true)
	{
		vReturnValue = window.showModalDialog("ReturnReceipt.aspx?MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	}
	else
	{
		if (confirmDelete(strmsg))
			vReturnValue = 1
		else
			vReturnValue = -1
	}
		
	return vReturnValue;
}

function confirmationBox5(strmsg)
{
	var vReturnValue = true;
	window.returnValue = false;
	
	if (document.parentalControl.chkDisable.checked)
	{
		if (isIE5Browser() == true)
			vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
		else
			vReturnValue = confirmDelete(strmsg)
	}
		
	return vReturnValue;
}

function doOK()
{
	window.returnValue = true;
	window.close();
}

function doCancel()
{
	window.returnValue = false;
	window.close();
}

function doYES()
{
	window.returnValue = 1;
	window.close();
}

function doNO()
{
	window.returnValue = -1;
	window.close();
}

function doNextTime()
{
	window.returnValue = 0;
	window.close();
}

/*
function askForReturnReceipt2(input, MailID, pageID, msg)
{
	if (input == "True")
	{
		vReturnValue = confirmationBox(msg);
		if(vReturnValue==true)
		{
			window.location.href = "showmail.aspx?&ID=" + MailID + "&pID=" + pageID + "&sr=y";
		}
	}
}
*/

function askForReturnReceipt(input, MailID, fID, pageID, sField, sSort, msg)
{
	if (input == "True")
	{
		vReturnValue = confirmationBox4(msg);
		if(vReturnValue!=0)
			window.location.href = "showmail.aspx?&ID=" + MailID + "&fID=" + fID + "&pID=" + pageID + "&sField=" + sField + "&sSort=" + sSort + "&sr=" + vReturnValue;
	}
}

function confirmationBox3(strmsg)
{
	vReturnValue = confirmationBox(strmsg);
	if(vReturnValue==true)
	{
		if(document.ComposeMail.confirmSendFromUpload != null)
		{
			document.ComposeMail.confirmSendFromUpload.value = "YES";	
		}
		return true; 
	}
	else 
	{
		if(document.ComposeMail.confirmSendFromUpload != null)
		{
			document.ComposeMail.confirmSendFromUpload.value = "NO";	
		}
		return true;
	}
}

function msgSource(mailId)
{
	window.open("msgSource.aspx?ID=" + mailId);
	return false;
}

function addDomain4To(cdoc,domain)
{

	return autoFilling2(domain, cdoc.ComposeMail.txtTo, cdoc, ' in field To')
	//autoFilling(domain,cdoc.ComposeMail.txtTo);
}

function addDomain4Cc(cdoc,domain)
{
	return autoFilling2(domain,cdoc.ComposeMail.txtCc, cdoc, ' in field Cc')
	//autoFilling(domain,cdoc.ComposeMail.txtCc);
}

function addDomain4Bcc(cdoc,domain)
{
	return autoFilling2(domain,cdoc.ComposeMail.txtBcc, cdoc, 'in field Bcc')
	//autoFilling(domain,cdoc.ComposeMail.txtBcc);
}

function addDomain4usrnm(cdoc, domain)
{
	return autoFilling2(domain,cdoc.login.txtUser, cdoc, '')
	//autoFilling(domain,cdoc.login.txtUser);
}
function autoFilling2( domain, line, cdoc, P )
{
	//disable the ErrMsg first. 
	e=cdoc.getElementById("ErrMsg");
	if (e == null) return true;
	e.style.display="none";

	wholeAddr = new String(line.value);
	err = new String ("");
	
	addr = new String("");	
	lengthOfAddr = wholeAddr.length;
	
	address_open = 0;
	quote_open = 0;
	bracket_open = 0;

	for (i=0;(i<lengthOfAddr) && ( err == '' ); i++)
	{	
		switch (wholeAddr.charAt(i))
		{
			case '"':   
				if (address_open == 0 )
				{ //0
					if ( quote_open == 0 ) 
					{//0,0
						if (bracket_open ==0)
						{//0,0,0
							address_open = 1;
							quote_open = 1;
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//0,0,1  not allowed
						//0,0,1  will not happen , will show error before came here .
						}
					}
					else
					{//0,1  not allowed  	
					// 0,1 will not happen , will show error before came here .
						/*
						if (@bracket_open ==0)
						{//0,1,0			
						}
						else 
						{//0,1,1			
						}
						*/
					}
				}
				else
				{//1
					if ( quote_open == 0 ) 
					{ //1,0
						if (bracket_open ==0)
						{//1,0,0
							err = 'Format Error: the character " should not be shown in middle of address, Or the quotation is not closed before position ' + i.toString() + P;
						}
						else 
						{//1,0,1	error
							err = 'Format Error: email address is not closed with > at position ' + i.toString() + P
						}
					}
					else 
					{//1,1
						if (bracket_open ==0)
						{//1,1,0
							quote_open =0;
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,1,1   not allowed , we do not allow starting a bracket < for an address, when quotation is not closed.
						// 1,1,1 will not happen , will show error before came here .	
						}		
					}
				}
				break;

			case ',' :
				if (address_open == 0 )
				{ //0
					if ( quote_open == 0 ) 
					{//0,0
						if (bracket_open ==0)
						{//0,0,0	extra comma
							//skip it 
						}
						else 
						{//0,0,1  not allowed
						//0,0,1  will not happen , will show error before came here .
						}
					}
					else 
					{//0,1  not allowed  	
					// 0,1 will not happen , will show error before came here .
						/*
						if (@bracket_open ==0)
						{//0,1,0			
						}
						else 
						{//0,1,1			
						}
						*/
					}
				}
				else 
				{//1
					if ( quote_open == 0 ) 
					{ //1,0
						if (bracket_open == 0 )
						{//1,0,0  one address finished	
							address_open = 0
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,0,1	error  like <asdfad@asd.com,  lost a >
							err = 'Format Error: email address is not closed with > at position ' + i.toString() + P
						}
					}
					else 
					{//1,1
						if (bracket_open ==0)
						{//1,1,0	 "," is in the quotation, this is not a address end mark. so go on next character	
							addr = addr + ";"; //change "," into ";" in the quotation
						}
						else 
						{//1,1,1   not allowed , we do not allow starting a bracket < for an address, when quotation is not closed.
						// 1,1,1 will not happen , will show error before came here .	
						}		
					}
				}
				break;
				
				
			case '<':
				if (address_open == 0 )
				{ //0
					if ( quote_open == 0 ) 
					{//0,0
						if (bracket_open ==0)
						{//0,0,0
							address_open = 1;
							bracket_open = 1;
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//0,0,1  not allowed
						//0,0,1  will not happen , will show error before came here .
						}
					}
					else 
					{//0,1  not allowed  	
					// 0,1 will not happen , will show error before came here .
						/*
						if (bracket_open ==0)
						{//0,1,0			
						}
						else 
						{//0,1,1			
						}
						*/
					}
				}
				else 
				{//1
					if ( quote_open == 0 ) 
					{ //1,0
						if (bracket_open ==0)
						{//1,0,0
							bracket_open = 1;	
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,0,1	error, aleady have < , < come again. 
							err = "Format Error: email address is not closed with > at position " + i.toString() + P
						}
					}
					else 
					{//1,1
						if (bracket_open == 0 )
						{//1,1,0  "<" is in the quotation, this is not a address start mark. so go on next character	
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,1,1   not allowed , we do not allow starting a bracket < for an address, when quotation is not closed.
						// 1,1,1 will not happen , will show error before came here .	
						}		
					}
				}
				break;

			case '>':
				if (address_open == 0 )
				{ //0
					if ( quote_open == 0 ) 
					{//0,0
						if (bracket_open ==0)
						{//0,0,0	error, >  cannot be first character in an address
							err = "Format Error: character > shows before < at position " + i.toString() + P
						}
						else 
						{//0,0,1  not allowed
						//0,0,1  will not happen , will show error before came here .
						}
					}
					else 
					{//0,1  not allowed  	
					// 0,1 will not happen , will show error before came here .
						
						/*if (@bracket_open ==0)
						{//0,1,0			
						}
						else 
						{//0,1,1			
						}
						*/
					}
				}
				else 
				{//1
					if ( quote_open == 0 ) 
					{ //1,0
						if (bracket_open ==0)
						{//1,0,0 error, ">"  cannot show up before "<"
							err = "Format Error: character '>' shows before '<' at position " + i.toString() + P
						}
						else 
						{//1,0,1	take off the space ' '. if have other character before ',', will be wrong
							bracket_open = 0;
							addr = addr + wholeAddr.charAt(i);
							i++;
							for (i; (( i < lengthOfAddr ) && ( err == '' )); i++)
							{
								if (wholeAddr.charAt(i) == ' ') 
								{
									continue;
								}
								else 
								{
									if (wholeAddr.charAt(i)==",")
									{
										i--; //keep ',' to next loop
										break;
									}
									else 
									{
										err = "Format Error: please input the ',' between two email address at position " + i.toString() + P;
									}
								}
							}//while 
						}//if-else
					}
					else 
					{//1,1
						if (bracket_open ==0)
						{//1,1,0	 ">" is in the quotation, this is not a address end mark. so go on next character
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,1,1   not allowed , we do not allow starting a bracket < for an address, when quotation is not closed.
						// 1,1,1 will not happen , will show error before came here .	
						}		
					}
				}
				break;
				
			case ' ':
				if (address_open == 0 )
				{ //0
					if ( quote_open == 0 ) 
					{//0,0
						if (bracket_open ==0)
						{//0,0,0   ignore the ' '
							//skip
						}
						else 
						{//0,0,1  not allowed
						//0,0,1  will not happen , will show error before came here .
						}
					}
					else 
					{//0,1  not allowed  	
					// 0,1 will not happen , will show error before came here .
						/*
						if (@bracket_open ==0)
						{//0,1,0			
						}
						else 
						{//0,1,1			
						}
						*/
					}
				}
				else 
				{//1
					if ( quote_open == 0 ) 
					{ //1,0
						if (bracket_open ==0)
						{//1,0,0	
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,0,1	error
							err = "Format Error: the space ' ' can not be put after '<' at postion " + i.toString() + P
						}
					}
					else 
					{//1,1
						if (bracket_open ==0)
						{//1,1,0 	' ' is in quataion. it's fine
							addr = addr + wholeAddr.charAt(i);
						}
						else 
						{//1,1,1   not allowed , we do not allow starting a bracket < for an address, when quotation is not closed.
						// 1,1,1 will not happen , will show error before came here .	
						}		
					}
				}
				break;
				
			default:
				if (address_open == 0 )
				{
					address_open = 1;
				}
				addr = addr + wholeAddr.charAt(i);
				break;								
		}//	switch
	}//for
	
	if (quote_open == 1  && err == '') 
		err = 'Format Error: the last quotation " is not closed' + P
		
	if (bracket_open == 1 && err == '')
		err = 'Format Error: the last bracket < is not closed' + P
		
	if( err != '')
	{
		e=cdoc.getElementById("ErrMsg");
		e.innerHTML = '<b>' + err + '</b>';
		e.style.display="block";
		e.style.color= 'red';	
		line.value = wholeAddr;
		return false;
	}
	
	//take out each name to process by split them with ','
	nameEnd = 0;
	eName = 0;
	nameFound = 0;	
	res = new String("");
	splitAddr = addr.split(",");
	for(i=0; i<splitAddr.length; i++)
	{
		if (splitAddr[i].length > 0)
		{
			noWhiteSpace = new String("");
			nameEnd = 0;
			
			for(j=0; j<splitAddr[i].length; j++)
			{
				if ((splitAddr[i].charAt(j) == '"') && (nameFound == 0))
					nameFound = 1;
				else if ((splitAddr[i].charAt(j) == '"') && (nameFound == 1))
				{
					nameFound = 0;
					nameEnd = j;
				}
					
				if ((nameFound == 1) || (splitAddr[i].charAt(j) != " ") || ((splitAddr[i].charAt(j) == " ") && (nameEnd == j - 1) && (j != 1)))
				{
					if ((j != 1) && (nameEnd == j - 1) && (splitAddr[i].charAt(j) != " "))
						noWhiteSpace = noWhiteSpace + " " + splitAddr[i].charAt(j);
					else
						noWhiteSpace = noWhiteSpace + splitAddr[i].charAt(j);
						
					if ((nameFound == 0) && (splitAddr[i].charAt(j) != "\""))
						eName = 1;
				}
			}
			
			if (noWhiteSpace.charAt(noWhiteSpace.length-1) == ' ')
				eName = 0;
				
			if (eName == 0)
			{
				window.alert("invalid address " + splitAddr[i]);
				return;
			}
			else if (noWhiteSpace.length > 0)
			{	
				if (res.length == 0)
				{
					//if (noWhiteSpace.indexOf("<") == -1)
					//{
					//	if (noWhiteSpace.indexOf("\"") == -1)
					//		noWhiteSpace = "<" + noWhiteSpace;
					//	else
					//		noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + "<" + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					//}	
					if (noWhiteSpace.indexOf("\"") != -1)
						noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					
					if (noWhiteSpace.indexOf("@") == -1)
					{
						if ( noWhiteSpace.indexOf(">") !=-1)
						{
							e=cdoc.getElementById("ErrMsg");
							e.innerHTML = "<b>Format Error: email address "+ noWhiteSpace+ P + " doesn't have @. Please enter valid e-mail addresses (e.g., in the format name@" + domain +").</b>";
							e.style.display="block";
							e.style.color= 'red';
							return false;
						}
						noWhiteSpace = noWhiteSpace.replace(";", ",") + "@" + domain;						
					}
					else
						noWhiteSpace = noWhiteSpace.replace(";", ",");

					//if (noWhiteSpace.indexOf(">") == -1)
					//	noWhiteSpace = noWhiteSpace + ">";
											
					res = noWhiteSpace;
				}
				else
				{
					//if (noWhiteSpace.indexOf("<") == -1)
					//{
					//	if (noWhiteSpace.indexOf("\"") == -1)
					//		noWhiteSpace = "<" + noWhiteSpace;
					//	else
					//		noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + "<" + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					//}				
					if (noWhiteSpace.indexOf("\"") == -1)
						noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
						
					if (noWhiteSpace.indexOf("@") == -1)
					{
						if ( noWhiteSpace.indexOf(">") !=-1)
						{
							e=cdoc.getElementById("ErrMsg");
							e.innerHTML = "<b>Format Error: email address "+ noWhiteSpace+ P + " doesn't have @. Please enter valid e-mail addresses (e.g., in the format name@" + domain +").</b>";
							e.style.display="block";
							e.style.color= 'red';
							return false;
						}
						noWhiteSpace = noWhiteSpace.replace(";", ",") + "@" + domain;						
					}
					else
						noWhiteSpace = noWhiteSpace.replace(";", ",");

					//if (noWhiteSpace.indexOf(">") == -1)
					//	noWhiteSpace = noWhiteSpace + ">";
						
					res = res + ", " + noWhiteSpace;
				}
			}
		}
	}
	line.value = res;
	return true
}//function autoFilling(domain,line, cdoc)

function autoFilling(domain,line)
{
	addrTmp = new String(line.value);

	//switch the ',' if any within the name "" to ';', like "Dole, john" to "Dole; john"
	addr = new String("");
	nameFound = 0;
	for (i=0; i<addrTmp.length;i++)
	{	
		if ((addrTmp.charAt(i) == '"') && (nameFound == 0))
			nameFound = 1;
		else if ((addrTmp.charAt(i) == '"') && (nameFound == 1))
			nameFound = 0;
		
		if ((addrTmp.charAt(i) == ',') && (nameFound == 1))
			addr = addr + ";";
		else
			addr = addr + addrTmp.charAt(i);
	}

	//take out each name to process by split them with ','
	nameEnd = 0;
	eName = 0;
	nameFound = 0;	
	res = new String("");
	splitAddr = addr.split(",");
	for(i=0; i<splitAddr.length; i++)
	{
		if (splitAddr[i].length > 0)
		{
			noWhiteSpace = new String("");
			nameEnd = 0;
			
			for(j=0; j<splitAddr[i].length; j++)
			{
				if ((splitAddr[i].charAt(j) == '"') && (nameFound == 0))
					nameFound = 1;
				else if ((splitAddr[i].charAt(j) == '"') && (nameFound == 1))
				{
					nameFound = 0;
					nameEnd = j;
				}
					
				if ((nameFound == 1) || (splitAddr[i].charAt(j) != " ") || ((splitAddr[i].charAt(j) == " ") && (nameEnd == j - 1) && (j != 1)))
				{
					if ((j != 1) && (nameEnd == j - 1) && (splitAddr[i].charAt(j) != " "))
						noWhiteSpace = noWhiteSpace + " " + splitAddr[i].charAt(j);
					else
						noWhiteSpace = noWhiteSpace + splitAddr[i].charAt(j);
						
					if ((nameFound == 0) && (splitAddr[i].charAt(j) != "\""))
						eName = 1;
				}
			}
			
			if (noWhiteSpace.charAt(noWhiteSpace.length-1) == ' ')
				eName = 0;
				
			if (eName == 0)
			{
				window.alert("invalid address " + splitAddr[i]);
				return;
			}
			else if (noWhiteSpace.length > 0)
			{	
				if (res.length == 0)
				{
					//if (noWhiteSpace.indexOf("<") == -1)
					//{
					//	if (noWhiteSpace.indexOf("\"") == -1)
					//		noWhiteSpace = "<" + noWhiteSpace;
					//	else
					//		noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + "<" + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					//}	
					if (noWhiteSpace.indexOf("\"") != -1)
						noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					
					if (noWhiteSpace.indexOf("@") == -1)
						noWhiteSpace = noWhiteSpace.replace(";", ",") + "@" + domain;
					else
						noWhiteSpace = noWhiteSpace.replace(";", ",");

					//if (noWhiteSpace.indexOf(">") == -1)
					//	noWhiteSpace = noWhiteSpace + ">";
											
					res = noWhiteSpace;
				}
				else
				{
					//if (noWhiteSpace.indexOf("<") == -1)
					//{
					//	if (noWhiteSpace.indexOf("\"") == -1)
					//		noWhiteSpace = "<" + noWhiteSpace;
					//	else
					//		noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + "<" + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
					//}				
					if (noWhiteSpace.indexOf("\"") == -1)
						noWhiteSpace = noWhiteSpace.substring(0, noWhiteSpace.lastIndexOf("\"") + 1) + noWhiteSpace.substring((noWhiteSpace.lastIndexOf("\"") + 1));
						
					if (noWhiteSpace.indexOf("@") == -1)
						noWhiteSpace = noWhiteSpace.replace(";", ",") + "@" + domain;
					else
						noWhiteSpace = noWhiteSpace.replace(";", ",");

					//if (noWhiteSpace.indexOf(">") == -1)
					//	noWhiteSpace = noWhiteSpace + ">";
						
					res = res + ", " + noWhiteSpace;
				}
			}
		}
	}
	line.value = res;
}

function selectAddr(chkBox, nickname, firstname, lastname)
{
	if (((nickname  != null) && (nickname.value  != ""))  || 
		((firstname != null) && (firstname.value != "")) || 
		((lastname  != null) && (lastname.value  != "")))
		chkBox.checked = true;
	else
		chkBox.checked = false;
}

function enableForward(thisdoc)
{
	thisdoc.ckbDisableforward.checked = false;
}

function disableForward(thisdoc)
{
	thisdoc.txtEmail.value = thisdoc.txtOldVal2.value;
	thisdoc.txtEmail.disabled = thisdoc.ckbDisableforward.checked;
		
	if (thisdoc.txtOldVal3.value == 'False')
		thisdoc.chkDropEmail.checked = false;
	else
		thisdoc.chkDropEmail.checked = true;
	thisdoc.chkDropEmail.disabled = thisdoc.ckbDisableforward.checked;
}

function enableReply(thisdoc)
{
	thisdoc.ckbDisablereply.checked = false;
}

function disableReply(thisdoc)
{
	thisdoc.txtReply.value = thisdoc.txtOldVal1.value;
	thisdoc.txtReply.disabled = thisdoc.ckbDisablereply.checked;	
}

function disableForward2(thisdoc)
{
	thisdoc.txtEmail.disabled = thisdoc.ckbDisableforward.checked;
	thisdoc.chkDropEmail.disabled = thisdoc.ckbDisableforward.checked;
}

function disableReply2(thisdoc)
{
	thisdoc.txtReply.disabled = thisdoc.ckbDisablereply.checked;
}

function changeFrom(thisdoc)
{
	tmp = new String(thisdoc.txtHidden.value);	
	splitTmp = tmp.split(",");
	for(i = 0; i < splitTmp.length; i = i + 2)
	{
		if (thisdoc.txtFrom.value == splitTmp[i])
		{
			if (splitTmp[i+1] == '0')
				thisdoc.chkDisableSignature.checked = false;
			else
				thisdoc.chkDisableSignature.checked = true;
			
			return;
		}
	}
}

function autoFillin(thisdoc)
{
	tmp = new String(thisdoc.txtHidden.value);	
	splitTmp = tmp.split(";");
	for(i = 0; i < splitTmp.length; i = i + 3)
	{
		if (thisdoc.ddlMajorISP.value == splitTmp[i])
		{
			thisdoc.txtSmtpHost.value = splitTmp[i+1];		
			thisdoc.txtPopHost.value  = splitTmp[i+2];
			return;
		}
	}
}

function callback4Action(thisdoc, action)
{
	if (document.getElementById('hiddenContainer') != null)
		document.getElementById('hiddenContainer').value = action;
	
	thisdoc.submit();
}

function callback4Move(thisdoc, folderID)
{
	if (document.getElementById('hiddenContainer2') != null)
		document.getElementById('hiddenContainer2').value = folderID;
	
	thisdoc.submit();
}

function c1(folderID)
{
	if (document.getElementById('hiddenContainer2') != null)
		document.getElementById('hiddenContainer2').value = folderID;
	
	document._default.submit();
}

function cA(urlStr, folderId2)
{
	window.location.href = urlStr + folderId2;
}

function callback4Pop(thisdoc, folderInfo, txtFolder)
{
	if (document.getElementById('hiddenContainer2') != null)
		document.getElementById('hiddenContainer2').value = folderInfo;
	
	if (document.getElementById(txtFolder) != null)
		document.getElementById(txtFolder).value = (folderInfo.split(','))[0];
}

function callback4MoveFrom(thisdoc, folderInfo, txtFolder)
{
	if (document.getElementById('hiddenContainer4') != null)
		document.getElementById('hiddenContainer4').value = folderInfo;
	
	if (document.getElementById(txtFolder) != null)
		document.getElementById(txtFolder).value = (folderInfo.split(','))[0];
}

function callback4MoveTo(thisdoc, folderInfo, txtFolder, chk)
{
	if (document.getElementById('hiddenContainer5') != null)
		document.getElementById('hiddenContainer5').value = folderInfo;
	
	if (document.getElementById(txtFolder) != null)
		document.getElementById(txtFolder).value = (folderInfo.split(','))[0];
		
	if (document.getElementById(chk) != null)
	{
		if (document.getElementById(chk).checked == true)
			document.getElementById(chk).checked = false;
	}
}

function callback4MoveToRoot(thisdoc, txtFolder, chk)
{
	if (document.getElementById(chk) != null)
	{
		if (document.getElementById(chk).checked == true)
		{
			if (document.getElementById('hiddenContainer5') != null)
				document.getElementById('hiddenContainer5').value = '';
		
			if (document.getElementById(txtFolder) != null)
				document.getElementById(txtFolder).value = '';
		}
		else
		{
			
		}
	}
}

function callback4SP(thisdoc, langInfo)
{
	if (document.getElementById('hiddenContainer3') != null)
	{
		document.getElementById('hiddenContainer3').value = langInfo;
		thisdoc.submit();	
	}
}

function overLimitASearch(thisdoc, strmsg)
{
	if (isIE5Browser() == true)
		window.showModalDialog("confirmBox.aspx?type=notice&MessId=" + strmsg, strmsg,"dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(strmsg)
}

function browser_type()
{
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

var oBw = new browser_type();

var SHIFT_KEYCODE = 16;
var CTRL_KEYCODE = 17;
var ALT_KEYCODE = 18;
var SHIFT_KEY = "shift";
var CTRL_KEY = "ctrl";
var ALT_KEY = "alt";

skey_keyevt.count=0;

function skey_keyevt(elm)
{
	this.id = "keyevt"+skey_keyevt.count++;
	eval(this.id + "=this");
	this.keys = new Array();
	this.shift=0;
	this.ctrl=0;
	this.alt=0;
	this.addKey = skey_addKey;
	this.keyevent = skey_keyevent;
	this.checkModKeys = skey_checkModKeys;
};

function skey_addKey(cdom,cns4,a,m)
{
	if(oBw.ie||oBw.dom) this.keys[cdom] = [a,m];
	else this.keys[cns4] = [a,m];
};

function skey_keyevent(evt)
{
	if(oBw.ie||oBw.op) evt=event;
	var k = (oBw.ie||oBw.op||oBw.ns6)? evt.keyCode:evt.which;
	this.checkModKeys(evt,k);
	if(this.keys[k]==null) return false;
	var m = this.keys[k][1];
	if((this.shift && (m.indexOf(SHIFT_KEY) != -1) || !this.shift && (m.indexOf(SHIFT_KEY) == -1)) && (this.ctrl && (m.indexOf(CTRL_KEY) != -1) || !this.ctrl && (m.indexOf(CTRL_KEY) == -1)) && (this.alt && (m.indexOf("alt") != -1) || !this.alt && (m.indexOf("alt") == -1)))
	{
		var a = this.keys[k][0];
		a = eval(a);
		if(typeof a == "function") a();
	}
};

function skey_checkModKeys(e,k)
{
	if(oBw.dom)
	{
		this.shift = e.shiftKey;
		this.ctrl = e.ctrlKey;
		this.alt = e.altKey;
	}
	else
	{
		this.shift = (k==SHIFT_KEYCODE) ? 1:0;
		this.ctrl = (k==CTRL_KEYCODE) ? 1:0;
		this.alt = (k==ALT_KEYCODE) ? 1:0;
	}
};

function feedTextBox(txt)
{
	if (document.getElementById("hidden_selection").value == "cc")
	{
		if (document.getElementById("txtCC").value.indexOf(txt) == -1)
		{
			if (document.getElementById("txtCC").value != "")
				document.getElementById("txtCC").value = document.getElementById("txtCC").value + ", " + txt;
			else
				document.getElementById("txtCC").value = txt;
		}
	}
	else if (document.getElementById("hidden_selection").value == "bcc")
	{
		if (document.getElementById("txtBCC").value.indexOf(txt) == -1)
		{
			if (document.getElementById("txtBCC").value != "")
				document.getElementById("txtBCC").value = document.getElementById("txtBCC").value + ", " + txt;
			else
				document.getElementById("txtBCC").value = txt;
		}
	}
	else
	{
		if (document.getElementById("txtTO").value.indexOf(txt) == -1)
		{
			if (document.getElementById("txtTO").value != "")
				document.getElementById("txtTO").value = document.getElementById("txtTO").value + ", " + txt;
			else
				document.getElementById("txtTO").value = txt;
		}
	}
	document.getElementById("cmdSubmit").focus();			
}

function sortContacts(txt)
{
	window.location.href = "contacts.aspx" + txt + "&curListTO=" + document.getElementById("txtTO").value + "&curListCC=" + document.getElementById("txtCC").value + "&curListBCC=" + document.getElementById("txtBCC").value + "&select=" + document.getElementById("hidden_selection").value;
}

function setFocus(txt)
{
	document.getElementById("hidden_selection").value = txt;
}

function updateEditFolderName(id)
{
	window.location.href = "folders.aspx?eid=" + id + "&name=" + document.getElementById("nn").value;
}

function cancelEditFolderName(id)
{
	window.location.href = "folders.aspx";
}

function enterKey(thisdoc)
{
	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) 
	{
		//window.location.href = "folders.aspx?eid=" + id + "&name=" + document.getElementById("nn").value;
		document.getElementById("hiddenContainer6").value = document.getElementById("nn").value;
		thisdoc.submit();
	}
}

function isEnterKey(e,funcName)
{	
	if(window.event)
		keyCode = event.keyCode
	else
		keyCode = e.which
	if(keyCode == 13 || keyCode == 0)
	{
		if (window.event)
		{
			event.returnValue = true ;
			event.cancel = false ;
		}
		else
		{
			e.returnValue = true ;
			e.cancelbubble = false;
		}		
		switch(funcName)
		{
			case "getSearch":	
				document._default.butSearch.focus();
				var value = document.getElementById('txtBSearch').value;
				if (value != '')
				{		
					var folderid = getfolderid();
					sUrl = 'findMsg.aspx?searchExp=' + value + '&chkFromChecked=1&searchSubject=true&folderList=' + folderid;					
					window.location.href = sUrl;		
				}	
				else 
				{
					document.getElementById('txtBSearch').focus();
				}			
				break;
			case "getMoveTo":
				document.getElementById("cmdMoveTo").focus();
				break;
			case "getGo":
				document.getElementById("cmdGo").focus();
				break;
		}		
		return false;
	}
}

function confirm1_folderPage(strmsg, txt1, txt2)
{
	var vReturnValue = true;
	window.returnValue = false;

	if (isIE5Browser() == true)
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + txt1 + strmsg + txt2, strmsg, "dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(strmsg)

	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function confirm2_folderPage(strmsg, txt1, txt2)
{
	var vReturnValue = true;
	window.returnValue = false;

	if (isIE5Browser() == true)
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + txt1 + strmsg + txt2, strmsg, "dialogWidth:350px;dialogHeight:150px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(strmsg)

	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function confirm3_folderPage(strmsg, txt)
{
	if (isIE5Browser() == true)
		window.showModalDialog("confirmBox.aspx?type=notice&MessId=" + txt, "notice", "dialogWidth:350px;dialogHeight:170px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		confirmDelete(strmsg)

	return false;
}

function confirm4_folderPage(txt)
{
	var vReturnValue = true;
	window.returnValue = false;

	if (isIE5Browser() == true)
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + txt, "notice", "dialogWidth:350px;dialogHeight:170px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(txt)

	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function confirm5_folderPage(txt)
{
	var vReturnValue = true;
	window.returnValue = false;

	if (isIE5Browser() == true)
		vReturnValue = window.showModalDialog("confirmBox.aspx?MessId=" + txt, "notice", "dialogWidth:350px;dialogHeight:170px;center:yes;scroll:no;resizable:no;help:no;status:no;edge:raised");
	else
		vReturnValue = confirmDelete(txt)

	if(vReturnValue)
		return vReturnValue;
	else
		return false;
}

function wizard()
{
	window.open('wizard_welcome.aspx', 'wizard', 'width=850, height=455, menubar=no, statusbar=no, toolbar=no, scrollbars=no, resizeable=no');
}

function checkDelMsg()
{
	if (document.options_generalAccount.DelOnServer.checked)
	{
		document.options_generalAccount.LeaveOnServer.checked = false;
		document.options_generalAccount.RemoveFromServerWhenDeleteFromTrash.checked = false;
	}
	else
		document.options_generalAccount.LeaveOnServer.checked = true;
}

function checkOnServer()
{
	if (document.options_generalAccount.LeaveOnServer.checked)
		document.options_generalAccount.DelOnServer.checked = false;
	else
		document.options_generalAccount.DelOnServer.checked = true;
}

function checkDeleteWhenTrash()
{
	if (document.options_generalAccount.RemoveFromServerWhenDeleteFromTrash.checked)
	{
		document.options_generalAccount.DelOnServer.checked = false;
		document.options_generalAccount.LeaveOnServer.checked = true;
	}
}

function pop1()
{
	event.returnValue=false;
	window.open('popup.aspx?pop=yes', 'update', 'width=450, height=550, menubar=no, statusbar=no, toolbar=no, scrollbars=yes, resizeable=yes');
}

function preview()
{
	if (document.getElementById("butPreviewBack") != null)
	{
		//window.location.replace("compose.aspx?preview=true");
		//window.location.href = "compose.aspx";
		//window.stop();	
	}
}


function switchEditor2(text)
{
	if(confirmationBox(text) == true)
		return true;
	else
		return false;
}
	
	
function setDefaulVals4SpellCheck()
{
	try
	{
		if ((document.getElementById('iBody') != null) && (document.getElementById('hiddenContainer2') != null))
		{
			iBody.document.write(document.getElementById('hiddenContainer2').value);
			iBody.highlight.setActive();
			iBody.highlight.scrollIntoView(false);
		}
	}
	catch(e)
	{
	}	
}
function refreshPage(location,interval)
{

	if(location!=null)
		window.setTimeout("window.location.href='"+location+"'",interval);
}
function onSend_wizardSignature()
{
	doUnToggleView();
	saveHtmlContents();
}
function checkbrowserCookie(message)
{
	var cookieName = 'testCookie' + (new Date().getTime());
    document.cookie = cookieName + '=cookieValue';
    var cookiesEnabled = document.cookie.indexOf(cookieName) != -1;
    alert(cookiesEnabled);
    if (!cookiesEnabled)
    {
       alert(message)
    }
      
}
function preloadimages(skinid)
{
	if(skinid != '')
	{
		var skinpath = '/images/skins/'+skinid+'/images/';
		if(document.images)
		{
			fckImgSrc = new Array (
				//skinpath + 'spacer.gif',
				//skinpath + 'toolbar.buttonbg.gif',
				skinpath + 'toolbar.separator.gif',
				skinpath + 'toolbar.arrowright.gif',   
				skinpath + 'toolbar.collapse.gif',     
				skinpath + 'toolbar.start.gif',
				skinpath + 'toolbar.bg.gif',           
				skinpath + 'toolbar.end.gif',          
				skinpath + 'toolbar.buttonarrow.gif',  
				skinpath + 'toolbar.expand.gif'
			)
			fckimgList = new Array ();
			for (i in fckImgSrc) 
			{
				fckimgList[i] = new Image();
				fckimgList[i].src = fckImgSrc[i];
			}
		}
		var buttonpath = '/images/skins/'+skinid+'/toolbar/';
		if(document.images)
		{
			fckBtnSrc = new Array (
				//buttonpath + 'about.gif',              
				buttonpath + 'justifyright.gif',          
				buttonpath + 'specialchar.gif',
				buttonpath + 'anchor.gif',                
				buttonpath + 'link.gif',                  
				//buttonpath + 'spellcheck.gif',             
				buttonpath + 'bgcolor.gif',                            
				//buttonpath + 'mail.gif',                               
				buttonpath + 'strikethrough.gif',
				buttonpath + 'bold.gif',                               
				buttonpath + 'new.gif',                                
				buttonpath + 'subscript.gif',
				//buttonpath + 'checkbox.gif',                           
				buttonpath + 'newpage.gif',                            
				buttonpath + 'superscript.gif',
				buttonpath + 'copy.gif',                               
				buttonpath + 'open.gif',                               
				buttonpath + 'table.gif',
				buttonpath + 'cut.gif',                                
				buttonpath + 'outdent.gif',                            
				buttonpath + 'tablecell.gif',
				buttonpath + 'find.gif',                               
				buttonpath + 'paste.gif',                              
				buttonpath + 'tabledeletecells.gif',
				//buttonpath + 'flash.gif',                              
				buttonpath + 'pastetext.gif',                          
				buttonpath + 'tabledeletecolumns.gif',
				buttonpath + 'fontstyleadv.gif',                       
				buttonpath + 'pasteword.gif',                          
				buttonpath + 'tabledeleterows.gif',
				buttonpath + 'form.gif',                               
				buttonpath + 'preview.gif',                            
				buttonpath + 'tableinsertcell.gif',
				buttonpath + 'hidden.gif',                             
				buttonpath + 'print.gif',                              
				buttonpath + 'tableinsertcolumn.gif',
				buttonpath + 'image.gif',                              
				//buttonpath + 'radio.gif',                              
				buttonpath + 'tableinsertrow.gif',
				//buttonpath + 'imagebutton.gif',                        
				buttonpath + 'redo.gif',                               
				buttonpath + 'tablemergecells.gif',
				buttonpath + 'indent.gif',                             
				buttonpath + 'removeformat.gif',                       
				buttonpath + 'tablesplitcell.gif',
				buttonpath + 'input.gif',                              
				buttonpath + 'replace.gif',                            
				buttonpath + 'textarea.gif',
				buttonpath + 'inserthorizontalrule.gif',               
				buttonpath + 'save.gif',                               
				buttonpath + 'textcolor.gif',
				buttonpath + 'insertorderedlist.gif',                  
				buttonpath + 'select.gif',                             
				buttonpath + 'underline.gif',
				buttonpath + 'insertunorderedlist.gif',                
				buttonpath + 'selectall.gif',                          
				buttonpath + 'undo.gif',
				buttonpath + 'italic.gif',                            
				//buttonpath + 'showdetails.gif',                        
				//buttonpath + 'universalkey.gif',
				buttonpath + 'justifycenter.gif',                      
				buttonpath + 'showtableborders.gif',                   
				buttonpath + 'unlink.gif',
				buttonpath + 'justifyfull.gif',                       
				buttonpath + 'smiley.gif',                             
				//buttonpath + 'unorderedlist.gif',
				buttonpath + 'justifyleft.gif',                        
				buttonpath + 'source.gif'   
			)
			btnImgList = new Array ();
			for (i in fckBtnSrc)
			{
				btnImgList[i] = new Image();
				btnImgList[i].src = fckBtnSrc[i];
			}
		}
	}
}

/***  pop portal ***/
function showPopPortal( url)
{
    try 
    {
        var portal=window.open( url, '_PopPortal', 'toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=1,height=1');    
        setTimeout('self.focus()', 80);
        return true;
    }
    catch(ex)
	{
	}
}
function popPortal_ff (url)
{
	var MM_contentVersion = 5;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
		{
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i];
		}
		var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
	&& (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
		document.write('<\/SCR' + 'IPT\> \n');
	}
	if ( MM_FlashCanPlay ) 
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="1" height="1"><param name="movie" value="./swf/pop.swf?d='+ url +'"><param name="quality" value="high"><embed src="./swf/pop.swf?d='+ url +'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></object>');
	} 
	setTimeout('self.focus()', 1000);
}
function loadportalunder(Urlstring){ 
    var ParentWindow;
    try
    {
        ParentWindow = self.opener;
        if (ParentWindow != null && ParentWindow != 'undefined'  )
        {
            ParentWindow.focus();
        }
        
        if (Urlstring != null && Urlstring != 'undefined' && Urlstring != '')
	    {
	        window.resizeTo(1024, 768);
            window.location.href = Urlstring;       
        }
        else
        {
            window.close();
        }  
       
    }
    catch(ex)
	{
	    if (Urlstring != null && Urlstring != 'undefined' && Urlstring != '')
	    {
	        window.resizeTo(1024, 768);
            window.location.href = Urlstring;    
        }
        else
        {
            window.close();
        }        
	}
}
/***  pop portal end***/
function canwestCode()
{
        try
         {  
                s.pageName=sPageName;
                s.server=window.location.hostname.toLowerCase();
                s.channel=adsite;
                s.pageType="";
                s.prop1=spath;
                s.prop2=spath;
                s.prop3=vendorname;
                s.prop4="";
                s.prop5="";
                s.prop6="";
                s.prop7="";
                s.prop8="";
                /* E-commerce Variables */
                s.campaign="";
                s.state="";
                s.zip="";
                s.events="";
                s.products="";
                s.purchaseID="";
                s.eVar1="";
                s.eVar2="";
                s.eVar3="";
                s.eVar4="";
                s.eVar5="";
                var s_code=s.t();
        }
        catch(e) 
        {                                   
        }
}
