// Talisma(tm) is a trademark and service mark of Talisma Corp. Copyright(c) 1998-2001 Talisma Corporation Pvt. Ltd. and its licensors. All rights reserved. -->
var isIE = (navigator.userAgent.indexOf("MSIE") > -1) ? true : false ;
var isMac = (navigator.userAgent.indexOf("Macintosh") > -1) ? true : false ;
var isIEMac = ((navigator.userAgent.indexOf("Macintosh") > -1) && (navigator.userAgent.indexOf("MSIE") > -1))? true : false ;
isIE4 = (navigator.userAgent.indexOf("MSIE 4") > -1) ? true : false ;

var NS6Image1 = new Image();
NS6Image1.width = 0  ;
NS6Image1.height = 0 ;

var DBSvr = "" ;
var DBName = "" ;
var sContextProps = "" ;

function ran()
{
	return Math.floor(10000*Math.random());
}

function getCookieVal (offset) 
{  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
		endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}	

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 GetCookie(name) 
{
	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;
}			

function StartCheck() 
{
	var iCookieAge = 365;	//in days
	var	expDate = new Date(); 
	expDate.setTime(expDate.getTime() + (iCookieAge*24*60*60*1000));			
		
	///////////Cookie Variables Declaration ////////////
	var QrySTr ="";		

	var tName = null;
	var tEmail = null;
	var bIgnoreCust = null;
	var tURL = window.parent.location.href ;
	var tIPAddress = null;
	var tBrowser = navigator.appName;
	var nCartValue = null;
	var tReferrer = null;
	var nFormSubmit = null;
	var tDemo = null;
	var nDemoClicked = null;
	var tBannerAd = null;
	var nBannerAdClicked = null;
	var tDownloadedFiles = null
	var tSurvey = null;

	/////////////////////////////////////////

	var re = / /g;
	tBrowser = tBrowser.replace(re, "%20");
	
	QryStr = ((tName == null || tName == "" || tName == "undefined" ) ? "" : ("&tName=" + escape(tName))) +  
		((tEmail == null || tEmail == "" || tEmail == "undefined" ) ? "" : ("&tEmail=" + escape(tEmail))) +
		((bIgnoreCust == null || bIgnoreCust == "" || bIgnoreCust == "undefined" ) ? "" : ("&bIgnoreCust=" + escape(bIgnoreCust))) +  
		((tURL == null || tURL == "" || tURL == "undefined") ? "" : ("&tURL=" + escape(tURL))) +  
		((tIPAddress == null || tIPAddress == "" || tIPAddress == "undefined") ? "" : ("&tIPAddress=" + escape(tIPAddress))) +  
		((tBrowser == null || tBrowser == "" || tBrowser == "undefined") ? "" : ("&tBrowser=" + escape(tBrowser))) +  
		((nCartValue == null || nCartValue == "" || nCartValue == "undefined") ? "" : ("&nCartValue=" + escape(nCartValue))) +  
		((tReferrer == null || tReferrer == "" || tReferrer == "undefined") ? "" : ("&tReferrer=" + escape(tReferrer))) +  
		((nFormSubmit == null || nFormSubmit == "" || nFormSubmit == "undefined") ? "" : ("&nFormSubmit=" + escape(nFormSubmit))) +  
		((tDemo == null || tDemo == "" || tDemo == "undefined") ? "" : ("&tDemo=" + escape(tDemo))) +  
		((nDemoClicked == null || nDemoClicked == "" || nDemoClicked == "undefined") ? "" : ("&nDemoClicked=" + escape(nDemoClicked))) +  
		((tBannerAd == null || tBannerAd == "" || tBannerAd == "undefined") ? "" : ("&tBannerAd=" + escape(tBannerAd))) +  
		((nBannerAdClicked == null || nBannerAdClicked == "" || nBannerAdClicked == "undefined") ? "" : ("&nBannerAdClicked=" + escape(nBannerAdClicked))) +  
		((tDownloadedFiles == null || tDownloadedFiles == "" || tDownloadedFiles == "undefined") ? "" : ("&tDownloadedFiles=" + escape(tDownloadedFiles))) +  
		((tSurvey == null || tSurvey == "" || tSurvey == "undefined") ? "" : ("&tSurvey=" + escape(tSurvey))) ; 
		
	strsrc = sTrackURL + "/WebTrack.asp?Fn=Start&DBSvr=" + DBSvr + "&DBName=" + DBName + "&SetCookie=True" + QryStr + "&num=" + ran();
	i400095.src = strsrc;
}

function StartChatSession(sAuto)
{
	if ( isIEMac)
	{
		alert("You need Netscape browser on Macintosh to use chat.");
		return;
	}

	var strurl = "";
	if ( sAuto.toUpperCase() == "FALSE")
	{
		if ( top.frames.length >  0 )
			if ( top.frames[0].name  == "CustPage" )
				return false;
	}
	if ( IntervalID != 0 ) {	
		vIntervalIDExists = true;
		window.clearInterval(IntervalID);
	}	
	if ( sChatURL.length > 0 ) 
	{
		var ans = true;
		if ( sAuto.toUpperCase() == "TRUE")
		{
		 	ans = confirm( "Our customer service representative will come online to assist you. Please wait...")			
		}
		if (ans) 
		{
			strurl = sTrackURL + "/StartChat.asp?ChatURL=" + sChatURL + "&Auto=" + sAuto + "&CurURL=" + escape(top.window.location.href) ;
			
			if ( sContextProps.length > 0 ) 
				strurl += "&" + sContextProps ;
			window.setTimeout("top.location.replace('" + strurl + "')", 20);
		}
		else
		{
			i400095 = new Image();
			i400095.src = sTrackURL + "/DenyChat.asp?ChatURL=" + sCheckURL + "&num=" + ran();
		}
	}
	return true;
}

function CheckOnTime()
{
	if (vIntervalIDExists)
		return; 

	var strsrc = sTrackURL + "/CheckChat.asp?num=" + ran() + "&DBSvr=" + DBSvr + "&DBName=" + DBName + "&CheckURL=" + sCheckURL;
	if ( NS6Image1.height == 1 && NS6Image1.width == 1 ) 
	{
		StartChatSession("True");
	}
	else
	{
		NS6Image1 = new Image();
		if ( !isIE  )
		{		
			NS6Image1.width = 0 ;
			NS6Image1.height = 0 ;
		}
		NS6Image1.src = strsrc;
	}
}

function EstimateTime(sAuto)
{
	if ( isIEMac)
	{
		alert("You need Netscape browser on Macintosh to use chat.");
		return;
	}

	var strurl = "";
	if ( sChatURL.length > 0 ) 
	{
		strurl = sTimeURL + "?doCheck=1&ChatURL=" + sChatURL + "&Auto=" + sAuto + "&CurURL=" + escape(top.window.location.href) ;
		if (sContextProps.length > 0 ) 
			strurl += "&" + sContextProps ;
		window.setTimeout("top.frames[1].location.replace('" + strurl + "')", 0);
	}
	return true;
}

function StartChecking()
{
	window.setTimeout("StartCheck()", 250);
	return;
}

if ( isIE ) 
{
	var i400094 = new Image();
	i400094.height= 0;
	i400094.width = 0;
}
var i400095 = new Image();
var IntervalID=0;
var vIntervalIDExists = true;



