// JavaScript Document
var closingflag;
var timeID;
var refreshRate = 2000;
var seid;
window.onload = getuserinfo('colurfulidianholidays')
var welcomeflag = 1

function openChat()
{
	 url = "http://idigitalmedia.net/buzzchat/userchat/index.asp"
	 url = url + "?user_id=" + "PALWIRCNYK101053899"
	 url = url + "&location=" + window.location
	window.open(url, "EcomChat", "marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=0, width=475, height=400, top=100, left=50");
}	


//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function getAjax()
{
	var XmlHttp;
	
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	return XmlHttp;
}


function getuserinfo(info)
{
				
			var url = "savetrackinfo.asp?user_id=10105";
			url = url+"&url=" + window.location
			url = url+"&info=" + info;
			closingflag = 1
						
	req = getAjax();
	
	req.onreadystatechange = function(){
	
		if( req.readyState == 4 && req.status == 200 ) {
					seid = req.responseText;
					if(welcomeflag==1)
						{
							var checkwelcome = confirm("Welcome to ColourfulIndianHolidays.com, An Travel Tour in India. If you need any online support, you can click on OK, within 02 min someone will guide you  or either you can initialize live chat yourself anytime.");
							welcomeflag = 2
							if (checkwelcome==true)
							{
								window.open("http://idigitalmedia.net/buzzchat/userchat/msgshow.asp?user_id=10105&seid="+seid, "EcomChat", "marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=0, width=475, height=400, top=100, left=50");
							}
						}
					setTimers();
			//FocusWindow();
		}
	}
	
	req.open( 'GET', url , true );
	req.send( null );
}

function setTimers()
{
	timeID = window.setTimeout( "checkanymessage()", refreshRate );
	
}

function checkanymessage()
{
	window.clearTimeout( timeID );
	getmsgtxt();
	setTimers();
}

function getmsgtxt()
{
	var url = "getadminrequest.asp?user_id=10105";
	req = getAjax();
	
	req.onreadystatechange = function(){
	
		if( req.readyState == 4 && req.status == 200 ) {
					var getflag = req.responseText;
					if (getflag==1)
						{
							window.open("http://idigitalmedia.net/buzzchat/userchat/msgshow.asp?user_id=10105&seid="+seid, "EcomChat", "marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=0, width=475, height=400, top=100, left=50");
						}
			//FocusWindow();
		}
	}
	
	req.open( 'GET', url , true );
	req.send( null );
}

