
//----- Timer
var secs
var timerID = null
var timerRunning = false
var delay = 1500
var delay1 = 1500

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 6
    StartTheTimer()

	secs1=6
	StartTheTimer1()
}


function StartTheTimer()
{
    if (secs==0)
    {
       // showRight(1); // call Function for timer

	showAdvertise()
	
	
		secs = 6
		StartTheTimer()
    }
    else
    {
       // self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function StartTheTimer1()
{
    if (secs1==0)
    {
       // showRight(1); // call Function for timer

	
	showGlobalAdvertise()
	
		secs1 = 6
		StartTheTimer1()
    }
    else
    {
       // self.status = secs
        secs1 = secs1 - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer1()", delay1)
    }
}


//-- End Timer
//-- Ajex
var xmlHttp
var xmlHttp1
var xmlHttp2
var xmlHttp3
var xmlHttp4
var xmlHttp5
var xmlHttp6
var xmlHttp7


// Global START-------------------------

	function showGlobalAdvertise()
		{
						
			xmlHttp7=GetXmlHttpObject();
			if (xmlHttp7==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/Global.asp";
			//url=url+"?head="+str;
			url=url+"?sid="+Math.random();
			xmlHttp7.onreadystatechange=ChangedshowGlobalAdvertise;
			xmlHttp7.open("GET",url,true);
			xmlHttp7.send(null);
			//alert(url)
		} 

	function ChangedshowGlobalAdvertise() 
		{ 
			if (xmlHttp7.readyState==4)
			{ 
				document.getElementById("txtadvertise01").innerHTML=xmlHttp7.responseText;
			}
		}

// Global END-----------------------------

function showAdvertise()
	{
					
		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/Banner.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;
		}
	}





function LoginPage()
	{
	
		var  rcmcno = parseInt(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("txttop").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();
		//alert(url)
		xmlHttp1.onreadystatechange=ChangedTop;
		xmlHttp1.open("GET",url,true);
		xmlHttp1.send(null);
		
	} 
	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();
		//alert(url)
		xmlHttp3.onreadystatechange=ChangedLeft;
		xmlHttp3.open("GET",url,true);
		xmlHttp3.send(null);
	} 

//					function showLeft_HOME(str)
//					{
//					
//						if (str.length==0)
//						  { 
//						  document.getElementById("txtLeft1").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_HOME.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;
	}

 
 //-- New Window onUnload---
 flag = 1;

if(location.reload==true)
{
	alert("")
	flag=0;
}

    function replay() 
    {
      if (flag==1) 
      {
        open("FeedBackForm.htm", "New_Window",'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=no,top=100'); 
      }
    }



//--Popup Window--

function addfile(url)
{
	var a = document.getElementById("ptfile")
	a.src=url
}
		function HideViewEvent(id,yr)
		{
			if(document.getElementById(id).value=yr)
			{
				document.getElementById(id).style.display='block'
				document.getElementById(yr).style.display='block'
				
			}
		}
		
		function hidetbl()
		{
			document.getElementById("WhatsNew").style.display='none'
			
			document.getElementById("Home").style.display='none'
		}
	function hide1()
	{
		document.getElementById("WhatsNew").style.display='none'
		
		document.getElementById("Home").style.display='none'
		
	}

	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 = window.open("http://apeda.com/apedawebsite/apedachat/default.asp","chatWin","toolbar=no,location=no,directories=no,status=1,menubar=no,scrollbars=1,resizable=yes,WIDTH="+screen.width+",HEIGHT="+screen.height+"");
				
				chatWin.location.href = "http://apeda.com/apedawebsite/apedachat/default.asp"
				if(navigator.appVersion.indexOf("4") != -1){
					chatWin.moveTo(0,0);
				}
			
		  }


// Rainbow---------------------------------->

function toSpans(span) {
  var str=span.firstChild.data;
  var a=str.length;
  span.removeChild(span.firstChild);
  for(var i=0; i<a; i++) {
    var theSpan=document.createElement("SPAN");
    theSpan.appendChild(document.createTextNode(str.charAt(i)));
    span.appendChild(theSpan);
  }
}


function RainbowSpan(span, hue, deg, brt, spd, hspd) {
    this.deg=(deg==null?360:Math.abs(deg));
    this.hue=(hue==null?0:Math.abs(hue)%360);
    this.hspd=(hspd==null?3:Math.abs(hspd)%360);
    this.length=span.firstChild.data.length;
    this.span=span;
    this.speed=(spd==null?50:Math.abs(spd));
    this.hInc=this.deg/this.length;
    this.brt=(brt==null?255:Math.abs(brt)%256);
    this.timer=null;
    toSpans(span);
    this.moveRainbow();
}

/*
 * sets the colors of the children of [this] as a hue-rotating rainbow starting at this.hue;
 * requires something to manage ch externally
 * I had to make the RainbowSpan class because M$IE wouldn't let me attach this prototype to [Object]
 */
RainbowSpan.prototype.moveRainbow = function() {
  if(this.hue>359) this.hue-=360;
  var color;
  var b=this.brt;
  var a=this.length;
  var h=this.hue;

  for(var i=0; i<a; i++) {

    if(h>359) h-=360;

    if(h<60) { color=Math.floor(((h)/60)*b); red=b;grn=color;blu=0; }
    else if(h<120) { color=Math.floor(((h-60)/60)*b); red=b-color;grn=b;blu=0; }
    else if(h<180) { color=Math.floor(((h-120)/60)*b); red=0;grn=b;blu=color; }
    else if(h<240) { color=Math.floor(((h-180)/60)*b); red=0;grn=b-color;blu=b; }
    else if(h<300) { color=Math.floor(((h-240)/60)*b); red=color;grn=0;blu=b; }
    else { color=Math.floor(((h-300)/60)*b); red=b;grn=0;blu=b-color; }

    h+=this.hInc;

    this.span.childNodes[i].style.color="rgb("+red+", "+grn+", "+blu+")";
  }
  this.hue+=this.hspd;
}

//
//<BODY>
//
//<div align="center">
//<h3 id="r1">This is a test of the RainbowSpan system</h3>
//</div>
//<script type="text/javascript">
//var r1=document.getElementById("r1"); //get span to apply rainbow
//var myRainbowSpan=new RainbowSpan(r1, 0, 360, 255, 50, 18); //apply static rainbow effect
//myRainbowSpan.timer=window.setInterval("myRainbowSpan.moveRainbow()", myRainbowSpan.speed);
//</script>
//
//
//<!-- Script Size:  4.85 KB -->

// End Rainbow-------------------------------------->

//-------------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)
}
 


//------------End-Blink------------------

//Translate-----------------------------

function VistLang(lang)
{
	
	//var fullurl = document.URL

	var fullurl = document.URL
	var temurl ="http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp="+lang+"&trurl="+fullurl
	
	
	window.open(temurl)
}


function OpenWindowAd(URL){
	//alert(URL)
		
		window.open(URL,"AddWin1","toolbar=yes,location=yes,directories=no,status=1,menubar=yes,scrollbars=1,resizable=yes,WIDTH="+screen.width+",HEIGHT="+screen.height+"");
		
			
  }

//End Translate-----------------------------
//DropDown List-----------------------------

function GotoURL(dl) { 
// FRAMES - To open a selection in a document that uses frames 
// change top.location.href to parent.putyourframenamehere.location.href

//alert(dl.droplist.value);//
window.open(dl.droplist.options[dl.droplist.selectedIndex].value);
} 

//End DropDown List-----------------------------



var growingImage = 5;
var i = 0;

function resizeImage(imageNumber) {
document.images[imageNumber].height -= 1
document.images[imageNumber].width -= 1
}

function increaseSizeImage(imageNumber) {

//document.images[imageNumber].height += 1
//document.images[imageNumber].width += 1

	window.open(imageNumber,'imgme','toolbar=no,location=no,directories=no,status=1,menubar=no,scrollbars=1,resizable=yes,WIDTH="500",HEIGHT="500""')
}

function CloseSizeImage(imageNumber) {

//document.images[imageNumber].height += 1
//document.images[imageNumber].width += 1

	window.open(imageNumber,'imgme')
	//	me.close();
}

function checkSize() {
if ((i == growingImage) && (document.images[i].height < 90)) {
increaseSizeImage(i)
}
if ((i != growingImage) && (document.images[i].height !=80)) {
resizeImage(i)
}
i++
if (i == 5) {i = 0}
setTimeout("checkSize()", 10)
}

