//----- Timer
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 6
    StartTheTimer()
}


function StartTheTimer()
{
    if (secs==0)
    {
        //showRight(1); // call Function for timer

		showAAHARAdvertise()
	
		secs = 6
		StartTheTimer()
    }
    else
    {
       // self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

//-- End Timer
//-- Ajex
var xmlHttp
var xmlHttp1
var xmlHttp2
var xmlHttp3
var xmlHttp4
var xmlHttp5

// AAHAR START-------------------------

function showAAHARAdvertise()
	{
					
		xmlHttp6=GetXmlHttpObject();
		if (xmlHttp6==null)
		  {
		    alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
			 return;
		  } 
		var url="../includes/AAHAR.asp";
		//url=url+"?head="+str;
		url=url+"?sid="+Math.random();
		xmlHttp6.onreadystatechange=ChangedAdvertise;
		xmlHttp6.open("GET",url,true);
		xmlHttp6.send(null);
		//alert(url)
	} 

function ChangedAdvertise() 
	{ 
		if (xmlHttp6.readyState==4)
		{ 
			document.getElementById("txtadvertise1").innerHTML=xmlHttp6.responseText;
		}
	}

// AAHAR END-----------------------------

function LoginPage()
	{
	
		var  rcmcno = document.getElementById("rcmcnotxt").value
		var  username = document.getElementById("usernametxt").value
		var  pwd = document.getElementById("passwordtxt").value
		

		if (rcmcno=="" || rcmcno ==null)
		{
			alert("APEDA RCMC No. is required ")
			return;
		}
		else
		{
			if(isNaN(rcmcno)==true)
			{
				alert("Only Numeric values are allowed in RCMC No. ")
				return;
			}

		}
		if (username=="" || username ==null)
		{
			alert("User Name is required ")
			return;
		}
		if (pwd=="" || pwd ==null)
		{
			alert("Password is required")
			return;
		}


		xmlHttp5=GetXmlHttpObject();
		if (xmlHttp5==null)
		  {
		  alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
		  return;
		  } 
		var url="../LoginPage/loginuser.asp";
		url=url+"?rcmcno="+rcmcno+"&username="+username+"&pwd="+pwd ;
		url=url+"&sid="+Math.random();
		//alert(url)
		xmlHttp5.onreadystatechange=ChangedLogin;
		xmlHttp5.open("GET",url,true);
		xmlHttp5.send(null);

		
	} 


	function showTop(str)
	{
	
		if (str.length==0)
		  { 
		  document.getElementById("txtop").innerHTML="";
		  return;
		  }
		xmlHttp1=GetXmlHttpObject();
		if (xmlHttp1==null)
		  {
		  alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
		  return;
		  } 
		var url="../includes/top.asp";
		url=url+"?q="+str;
		url=url+"&sid="+Math.random();
		
		xmlHttp1.onreadystatechange=ChangedTop;
		xmlHttp1.open("GET",url,true);
		xmlHttp1.send(null);
		//alert(xmlHttp1)
	} 
	function showBottom(str)
	{
	
		if (str.length==0)
		  { 
		  document.getElementById("txtBottom").innerHTML="";
		  return;
		  }
		xmlHttp2=GetXmlHttpObject();
		if (xmlHttp2==null)
		  {
		  alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
		  return;
		  } 
		var url="../includes/bottom.asp";
		url=url+"?q="+str;
		url=url+"&sid="+Math.random();
		xmlHttp2.onreadystatechange=ChangedBottom;
		xmlHttp2.open("GET",url,true);
		xmlHttp2.send(null);
	} 
	function showLeft(str)
	{
	
		if (str.length==0)
		  { 
		  document.getElementById("txtLeft").innerHTML="";
		  return;
		  }
		xmlHttp3=GetXmlHttpObject();
		if (xmlHttp3==null)
		  {
		  alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
		  return;
		  } 
		var url="../includes/left.asp";
		url=url+"?q="+str;
		url=url+"&sid="+Math.random();
		xmlHttp3.onreadystatechange=ChangedLeft;
		xmlHttp3.open("GET",url,true);
		xmlHttp3.send(null);
	} 
	function showRight(str)
	{
	
		if (str.length==0)
		  { 
		  document.getElementById("txtRight").innerHTML="";
		  return;
		  }
		xmlHttp4=GetXmlHttpObject();
		if (xmlHttp4==null)
		  {
		  alert ("Your browser does not support AJAX! \n If you are using I.E. 7.0 then do following Steps \n 1. In browser, go to Tools > Internet options > 'Advanced' tab > 'Security' section. \n 2. Disable the 'Enable native XMLHTTP support' checkbox.");
		  return;
		  } 
		var url="../includes/right.asp";
		url=url+"?q="+str;
		url=url+"&sid="+Math.random();
		xmlHttp4.onreadystatechange=ChangedRight;
		xmlHttp4.open("GET",url,true);
		xmlHttp4.send(null);
	} 

	function ChangedLogin() 
	{ 
		if (xmlHttp5.readyState==4)
		{ 
			document.getElementById("txtmsg").innerHTML=xmlHttp5.responseText;
		}
	}


	function ChangedTop() 
	{ 
		if (xmlHttp1.readyState==4)
		{ 
			//alert()
			document.getElementById("txttop").innerHTML=xmlHttp1.responseText;
		}
	}
	function ChangedBottom() 
	{ 
		if (xmlHttp2.readyState==4)
		{ 
			document.getElementById("txtBottom").innerHTML=xmlHttp2.responseText;
		}
	}
	function ChangedLeft() 
	{ 
		if (xmlHttp3.readyState==4)
		{ 
			document.getElementById("txtLeft").innerHTML=xmlHttp3.responseText;
		}
	}
	function ChangedRight() 
	{ 
		if (xmlHttp4.readyState==4)
		{ 
			document.getElementById("txtRight").innerHTML=xmlHttp4.responseText;
		}
	}
	
	function GetXmlHttpObject()
	{
	//var 
	xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
	}


				function enterChat(){
				//alert("Inside Function")
					chatWin = window.open("http://apeda.com/apedawebsite/apedachat/default.asp","chatWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,WIDTH=630,HEIGHT=600");
				chatWin.location.href = "http://apeda.com/apedawebsite/apedachat/default.asp"
				if(navigator.appVersion.indexOf("4") != -1){
					chatWin.moveTo(0,0);
				}
			
	
		  }





		  //-------------Blink------------------


function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",600)
}
//window.onload = startBlink();

function OpenWindowBig(URL,title)
{
	 var newWin = window.open(URL, title,"status=1,menubar=yes,toolbar=no, scrollbars=1,resizable=yes,height="+ (screen.height-10) + ",width=" + (screen.width-10) + ",top=0,left=0"); 
  	 newWin.focus(); 

}
//------------End-Blink------------------