// JavaScript Document

var eventname;
function cls()
{
	var x;
	x = document.getElementById("overlay");
	//document.getElementById("container").removeChild(x);	
	y = document.getElementById("linklog");
	//document.getElementById("linkback").removeChild(x);
	contfadeout(x,y,100);	
}

function contfadeout(obj1,obj2,i)
{
	if(i>=20)
	{
		cn = "f"+i;
		obj1.className = cn;
		obj2.className = cn;
		i = i-10;
		setTimeout(function(){contfadeout(obj1,obj2,i)},50);
	}
	else
	{
		x = document.getElementById("overlay");
		y = document.getElementById("linklog");
		document.getElementById("linkback").removeChild(y);
		document.getElementById("container").removeChild(x);
		ject = new Updates('UpdatesContainer');
		next();
	}
	
	
}

function newcls()
{
	var x;
	x = document.getElementById("overlay");
	newcontfadeout(x,100);	
}

function newcontfadeout(obj1,i)
{
	if(i>=20)
	{
		cn = "f"+i;
		obj1.className = cn;
		i = i-10;
		setTimeout(function(){newcontfadeout(obj1,i)},50);
	}
	else
	{
		x = document.getElementById("overlay");
		document.getElementById("container").removeChild(x);
		ject = new Updates('UpdatesContainer');
		next();		
	}
	
	
}

function nothing(e)
{
	if(!e) var e=window.event;
	e.cancelBubble = true;
	if(e.stopPropagation) e.stopPropagation();
	
}


function getcon(evt)
{

	while(evt.indexOf("_") != -1)
		evt = evt.replace("_"," ");

	var urlst="event.php?evt="+evt;	

	
	eventname=evt;
	document.getElementById('evttitle').innerHTML = eventname;
	httpv.open("GET",urlst,true);
    httpv.onreadystatechange = handleHttpResponse;
    httpv.send(null);
}

function handleHttpResponse() 
{   
	if(httpv.readyState == 4) 
	{
    	if(httpv.status==200)
		{
		
        	var results=httpv.responseText;
			var str = new Array();
			var temp;
			nt=0;
			str = results.split("||");
			for(i =0 ;i<str.length;i++)
			{
				temp = new Array();
				temp = str[i].split("|");
				contnt[i] = temp[1];
				linknt[i] = temp[0];
				nt++;
			}
			con1 = contnt[0];
			prev= null;
			loadcon(con1);
			
			
			
        }
   }
   if(httpv.readyState == 1)
   {
		
		document.getElementById('spevtlink').innerHTML = "";
		document.getElementById('mainevtcontent').innerHTML = "Loading...";
		//loadframe(eventname);


	
   }
}



function getHTTPObject()
{
  var xmlhttp;
  if(window.XMLHttpRequest)
  {
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject)
  {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp)
	{
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   
  }
  return xmlhttp;
}

var httpv = getHTTPObject();
var contnt = new Array();
var linknt = new Array();
var nt = 0;


function change(obj,x)
{
	if(!prev)
	{
		prev = document.getElementById("first");
	}
	if(prev.innerHTML != obj.innerHTML)
	{
		prev.setAttribute("class","");
		prev.className="";
		prev = obj;
		prev.setAttribute("class","on");
		prev.className="on";
		document.getElementById("mainevtcontent").innerHTML = contnt[x];
	}

	
}

prev = document.getElementById("first");
function loadframe(et)
{
			n1 = document.createElement('div');
			n1.setAttribute('id','maineventborder');
			n1.setAttribute('onclick','nothing(event)');
			n1.onclick=function(event){nothing(event)};
			var scll = new Array();
			scll=getScrollXY();
			var x;
			x = scll[1]+100;

				
			document.getElementById("innerwrapper1").appendChild(n1);
			n1.innerHTML = "<div id=innerwrapper2></div>";
		fix(document.getElementById("innerwrapper2"));
		
			n2 = document.createElement('div');
			n2.setAttribute('id','mainevent');
			n2.setAttribute('onclick','nothing(event)');
			document.getElementById("innerwrapper2").appendChild(n2);
	//		n2.onclick=function(){cls()}
	if (et == "K PLUS PLUS")
		et = K++;
	
			n2.innerHTML="<div id=\"evetit\"><table border=0 width=100%><tr><td>"+et.toUpperCase()+"</td><td align=right><font size=1px>Close</font> <font size=\"+1\"><a href=# onclick=cls()>X</a></font></td></tr></table></div>";  
			 
			
		nn2 = document.createElement('div');
		nn2.setAttribute('id','loadg');
		document.getElementById('mainevent').appendChild(nn2);
			
}
function loadcon(con1)
{
	
			n3 = document.getElementById('spevtlink');
			n3.innerHTML="<a href=\"javascript:void(0)\" id=\"first\" class=\"on\" onclick=\"change(this,0)\">"+linknt[0]+"</a>";
			for(i=1;i<nt;i++)
			{
				n3.innerHTML+=" | <a href=\"javascript:void(0)\" onclick=\"change(this,"+i+")\">"+linknt[i]+"</a></li>";
			}
        	
		
			n3 = document.getElementById('mainevtcontent');
			n3.innerHTML=con1;

	/*		n3 = document.createElement('div');
			n3.setAttribute('id','evtcontent2');
			document.getElementById("mainevent").appendChild(n3);
			n3.innerHTML=con2;

			n3 = document.createElement('div');
			n3.setAttribute('id','evtcontent3');
			document.getElementById("mainevent").appendChild(n3);
			n3.innerHTML=con3;

			n3 = document.createElement('div');
			n3.setAttribute('id','evtcontent4');
			document.getElementById("mainevent").appendChild(n3);
			n3.innerHTML=con4;*/

}


function correctPNG1(pngg)
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (version<7.0) && (document.body.filters)) 
   {
         var img1 = document.images[pngg];
		// img1 = pngg;
         var imgName = img1.src;
         var imgID = (img1.id) ? "id='" + img1.id + "' " : "";
         var imgClass = (img1.className) ? "class='" + img1.className + "' " : "";
         var imgTitle = (img1.title) ? "title='" + img1.title + "' " : "title='" + img1.alt + "' ";
         var imgStyle = "display:inline-block;" + img1.style.cssText ;
         if (img1.align == "left") imgStyle = "float:left;" + imgStyle;
         if (img1.align == "right") imgStyle = "float:right;" + imgStyle;
         if (img1.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
         var strNewHTML = "<span " + imgID + imgClass + imgTitle  + " style=\"" + "width:" + img1.width + "px; height:" + img1.height + "px;" + imgStyle + ";"  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"     + "(src=\'" + img1.src + "\', sizingMethod='scale');\"></span>" ;
            img1.outerHTML = strNewHTML;

     
   }    
}

function correctPNG()
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (version<7.0) && (document.body.filters)) 
   {
	  for(var i=0; i<document.images.length; i++)
      {
         var img1 = document.images[i]
         var imgName = img1.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img1.id) ? "id='" + img1.id + "' " : ""
            var imgClass = (img1.className) ? "class='" + img1.className + "' " : ""
            var imgTitle = (img1.title) ? "title='" + img1.title + "' " : "title='" + img1.alt + "' "
            var imgStyle = "display:inline-block;" + img1.style.cssText 
            if (img1.align == "left") imgStyle = "float:left;" + imgStyle
            if (img1.align == "right") imgStyle = "float:right;" + imgStyle
            if (img1.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img1.width + "px; height:" + img1.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img1.src + "\', sizingMethod='scale');\"></span>" 
            img1.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}


function fixhomepng()
{
	obj=document.getElementById("headerk");
	fix(obj);
	obj=document.getElementById("headerceg");
	fix(obj);
	obj=document.getElementById("headerint");
	fix(obj);
	obj=document.getElementById("headerd");
	fix(obj);
	obj=document.getElementById("linkleft");
	fix(obj);
	obj=document.getElementById("innerwrapper2");
	fix(obj);
	obj=document.getElementById("linkright");
	fix(obj);
	obj=document.getElementById("innerwrapper1");
	fix(obj);
	
	
	
}
function fixpng()
{
	obj=document.getElementById("headerk");
	fix(obj);
	obj=document.getElementById("headerceg");
	fix(obj);
	obj=document.getElementById("headerint");
	fix(obj);
	obj=document.getElementById("headerd");
	fix(obj);
	obj=document.getElementById("linkleft");
	fix(obj);
	obj=document.getElementById("innerwrapper2");
	fix(obj);
	obj=document.getElementById("linkright");
	fix(obj);
	
	
	
}

	function fix(obj)
	{
		
	   var arVersion = navigator.appVersion.split("MSIE");
	   var version = parseFloat(arVersion[1]);
	   if(version >= 6.9)
	   {
		
		if(obj.id == "innerwrapper1")
		{
			obj.style.height=document.body.clientHeight;
		}
	   }
	   if ((version >= 5.5) && (version<7.0) && (document.body.filters)) 
	   {
		document.getElementById("linkmiddle").style.width=650+"px";
		if(obj.id == "innerwrapper1")
		{
			obj.style.height=document.body.clientHeight;
		}
		var mode = 'scale';
		var shim= 'x.gif';
		var bg	= obj.currentStyle.backgroundImage;
		var src1 = bg.substring(5,bg.length-2);
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src1 + "', sizingMethod='" + mode + "')";
		obj.style.backgroundImage = 'url('+shim+')';
	   }
	}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
 
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
 
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
 
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}


function popdob()
{
	fixpng();
   var arVersion = navigator.appVersion.split("MSIE");
   var version = parseFloat(arVersion[1]);
	if(version > 4)
	{
		popdobie();
	}
	else

	{
	y1 = document.getElementById("yr");
	for(i=2000;i>=1935;i--)
		y1.innerHTML += "<option>"+i+"</option>";
		
	}
	

}

function popdobie()
{
	j= 1;
	form1.year.options[0] = new Option("---");
	for(i=2000;i>=1935;i--)
	{
		form1.year.options[j] = new Option(i);
		j++;
	}
	
}

function popdate()
{
    var arVersion = navigator.appVersion.split("MSIE");
    var version = parseFloat(arVersion[1]);	
	if(version > 4)
	{
		popdateie();
	}
	
	else
	{
	d = document.getElementById("dt");
	y = document.getElementById("yr").value;	
	d.innerHTML = "---";
	var dtt = document.getElementById("date1");
	m = document.getElementById("mn").value;	
	if(y != "---"  )
	{
		if(m != "---")
		{
			dtt.style.visibility="hidden";
			for(i=1;i<=28;i++)
			{
				d.innerHTML+="<option>"+i+"</option>";	
			}

			if(m!= "Feb")
			{
				d.innerHTML += "<option>29</option><option>30</option>";
				if(m == "Jan" || m == "Mar" || m == "May" || m == "Jul" || m == "Aug" || m == "Oct" || m == "Dec")
					d.innerHTML += "<option>31</option>";
			}
			else
			{
				y = parseInt(y);	
				if(y%4 == 0)
					d.innerHTML += "<option>29</option>";
			}
		}
		else
		{
			dtt.innerHTML = "Select Month";
			dtt.style.visibility="visible";	
		}
	}
	else
	{
		dtt.innerHTML = "Select Year";
		dtt.style.visibility="visible";
	
	}
	}
}


function popdateie()
{
	d = form1.datee;
	y = form1.year.options[form1.year.selectedIndex].text;	
	d.options[0] = new Option("---");
	var dtt = document.getElementById("date1");
	m = form1.month.options[form1.month.selectedIndex].text;	
	if(y != "---"  )
	{
		if(m != "---")
		{
			dtt.style.visibility="hidden";
			for(i=1;i<=28;i++)
			{
				d.options[i] = new Option(i);	
			}
			if(m!= "Feb")
			{
				
				d.options[29] = new Option(29);
				d.options[30] = new Option(30);
				if(m == "Jan" || m == "Mar" || m == "May" || m == "Jul" || m == "Aug" || m == "Oct" || m == "Dec")
				
					d.options[31] = new Option(31);
				else
					d.options[31] = null;
			}
			else
			{
				y = parseInt(y);	
				d.options[29] = null;
				d.options[30] = null;
				d.options[31] = null;
				if(y%4 == 0)
					d.options[29] = new Option(29);
			}
		}
		else
		{
			dtt.innerHTML = "Select Month";
			dtt.style.visibility="visible";	
		}
	}
	else
	{
		dtt.innerHTML = "Select Year";
		dtt.style.visibility="visible";
	
	}
}




function popsome()
{
    var arVersion = navigator.appVersion.split("MSIE");
    var version = parseFloat(arVersion[1]);	
	if(version > 4)
	{
		popsomeie();
	}
	
	m = document.getElementById("mn").value;
	dtt = document.getElementById("date1");
	dtt.style.visibility="hidden";
	if(m != "---")
		popdate();
}

function popsomeie()
{
	m = form1.month.options[form1.month.selectedIndex].text;
	dtt = document.getElementById("date1");
	dtt.style.visibility="hidden";
	if(m != "---")
		popdate();
}

function handleResponse() 
{   

	if(httpc.readyState == 4) 
	{
    	if(httpc.status==200)
		{
			document.getElementById("capt1").src = "captcha.php?"+ Math.random();
        }
   }
}



function changeimg()
{
   httpc.open("GET","captcha.php",true);
   httpc.onreadystatechange = handleResponse;
   httpc.send(null);
	
}

var httpc = getHTTPObject();

function regpt(obj)
{
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etid = obj.evtid.value;
	etname = obj.evt.value;
	url = "regevt.php?type=regpt&pt="+pt+"&etsize="+etsize+"&etid="+etid+"&etname="+etname;
    httpc.open("GET","url",true);
    httpc.onreadystatechange = regevtResponse;
    httpc.send(null);
	return false;
	
}

function regevtResponse() 
{   

	if(httpc.readyState == 4) 
	{
    	if(httpc.status==200)
		{
		   i = 0;
		   while(linknt[i] != "Register")
		   {
			   i++;
		   }
		   rt = httpc.responseText;
		   document.getElementById('evtcontent1').innerHTML = rt;
		   contnt[i] = rt;
		}
   }
   else
   {
	   	   document.getElementById('evtcontent1').innerHTML = "loading .."+httpc.readyState;
   }
}

function addpt(obj,tid)
{
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etname = obj.evt.value;
	url = "regevt.php?type=addpt&pt="+pt+"&etsize="+etsize+"&etname="+etname+"&tid="+tid;
    httpc.open("GET","url",true);
    httpc.onreadystatechange = regevtResponse;
    httpc.send(null);
	return false;
}

function remove(em,tid,etname)
{
	url = "regevt.php?type=remove&email="+em+"&tid="+tid+"&etname="+etname;
    httpc.open("GET","url",true);
    httpc.onreadystatechange = regevtResponse;
    httpc.send(null);
	
}

function removeself(tid,etname)
{
	url = "regevt.php?type=removeself&email="+em+"&tid="+tid+"&etname="+etname;
    httpc.open("GET","url",true);
    httpc.onreadystatechange = regevtResponse;
    httpc.send(null);
}



var evtlist = new Array();
var defaultcon = new Array();
evtlist[0] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"K_PLUS_PLUS\")>K++ Think Open</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Heptathlon\")>Heptathlon</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"OLP\")>Online Programming Contest</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"OSP\")>Onsite Programming Contest</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"AI_Game_Dev\")>AI Game Dev</a><br><Br><a href=\"javascript:void(0)\" onclick=getcon(\"Flashback\")>Flashback</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Cerebra\")>Cerebra</a></span>";
evtlist[1] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"XCEED\")>Xceed</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Designers_Quest\")>Designer\'s Quest</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"The_Road_Not_Taken\")>The Road Not Taken</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Line_Follower\")>Robotics - Line Follower</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Robo_Soccer\")>Robo Soccer</a></span>";
evtlist[2] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Autoshow\")>Autoshow</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Inspiring_India_Exhibition\")>Inspiring India Exhibition</a></span>";
evtlist[3] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Dalal_Bull\")>Dalal Bull</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Business_Plan\")>Business Plan</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Marketing_Guru\")>Marketing Guru</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"PD3\")>PD<sup>3</sup></a></span>";
evtlist[4] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Aeromodelling\")>Aeromodelling</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Rumble_in_the_junk\")>Rumble in the junk</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Contraptions\")>Contraptions</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Rocketry\")>Rocketry</a></span>";
evtlist[5] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Online_Quiz\")>Online Quiz</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Business_Quiz\")>Business Quiz</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Open_quiz\")>Open quiz</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Scitech_Quiz\")>Scitech Quiz</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Math_Quiz\")>Math Quiz</a></span>";
evtlist[6] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Alcatraz\")>Alcatraz</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Electrowarriors\")>Electrowarriors</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Innovate\")>Innovate</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Math_Modelling\")>Math Modelling</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Megastructures\")>Megastructures</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Prof_Challenge\")>Prof Challenge</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"GodSpeed\")>GodSpeed</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Avant_Garde\")>Avant Garde</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Fox_hunt\")>Fox hunt</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"K!dol\")>K!dol</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Envisage\")>Envisage</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Embedded_System_Design\")>Embedded System Design</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Vestas_Innovation_Challenge\")>Vestas Innovation Challenge</a><br><Br></span>";
evtlist[7] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"General\")>General</a><br><Br><a href=\"javascript:void(0)\" onclick=getcon(\"Energy_Conclave\")>Energy Conclave</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Entrepreneurship_Summit\")>Entrepreneurship Summit</a></span>"
evtlist[8] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Entrepreneurship_Workshop\")>Entrepreneurship Workshop</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Animation_Workshop\")>Animation Workshop</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"GPS\")>GPS</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"ITRIX\")>ITRIx</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"ANIMATRONIX\")>Animatronix</a><bR><br><a href=\"javascript:void(0)\" onclick=getcon(\"Math_Workshop\")>Math Workshop</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"OPEN_SOURCE\")>Open Source Workshop</a><bR><br><a href=\"javascript:void(0)\" onclick=getcon(\"Software_Defined_Radio\")>Software Defined Radio</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Automotive_Workshop\")>Automotive Workshop</a></span>";
evtlist[9] = "<span><a href=\"javascript:void(0)\" onclick=getcon(\"Gamindrome\")>Gamindrome</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"How_Stuff_Works\")>How Stuff Works</a></span><span><a href=\"javascript:void(0)\" onclick=getcon(\"Autostyle\")>Autostyle</a><br><br><a href=\"javascript:void(0)\" onclick=getcon(\"Prove_or_Disprove\")>Prove or Disprove</a></span>";
 
defaultcon[0] = "K_PLUS_PLUS";
defaultcon[1] = "XCEED";
defaultcon[2] = "Autoshow";
defaultcon[3] = "Dalal_Bull";
defaultcon[4] = "Aeromodelling";
defaultcon[5] = "Online_Quiz";
defaultcon[6] = "Alcatraz";
defaultcon[7] = "General";
defaultcon[8] = "Entrepreneurship_Workshop";
defaultcon[9] = "Gamindrome";

var prev1;

function changelist(x,obj)
{
	if(!prev1)
	{
		prev1 = document.getElementById("first1");
	}
	if(prev1.innerHTML != obj.innerHTML)
	{
		prev1.setAttribute("class","");
		prev1.className="";
		prev1 = obj;
		prev1.setAttribute("class","mit");
		prev1.className="mit";
		document.getElementById("evt1layer").innerHTML = evtlist[x];
		getcon(defaultcon[x]);
	}
	
}

function getcon1(evtn,obj)
{
	if(!prev1)
	{
		prev1 = document.getElementById("first1");
	}
	if(prev1.innerHTML != obj.innerHTML)
	{
		prev1.setAttribute("class","");
		prev1.className="";
		prev1 = obj;
		prev1.setAttribute("class","mit");
		prev1.className="mit";
		getcon(evtn);	
	}


}
function getcon2(evtn,x)
{
	if(!prev1)
	{
		prev1 = document.getElementById("first1");
	}
	if(prev1.innerHTML != obj.innerHTML)
	{
		prev1.setAttribute("class","");
		prev1.className="";
		oxx = document.getElementById("evtlayer");
		if(x == 1)
			oxx.innerHTML = "<a href='javascript:void(0)' onclick=getcon1(\"Xceed\",this) >About Xceed</a> <a href='javascript:void(0)' onclick=getcon1('Line_Follower',this) class='mit' id='first1'>Line Follower</a> <a href='javascript:void(0)' onclick=getcon1('ROBO_SOCCER',this)>Robo Soccer</a>";
		if(x == 2)
			oxx.innerHTML = "<a href='javascript:void(0)' onclick=getcon1(\"Xceed\",this) >About Xceed</a> <a href='javascript:void(0)' onclick=getcon1('Line_Follower',this) >Line Follower</a> <a href='javascript:void(0)' onclick=getcon1('ROBO_SOCCER',this) class='mit' id='first1'>Robo Soccer</a>";		
		prev1 = null;
		
		getcon(evtn);	
	}


}


function evtload(nettt,showno)
{
	fixpng();
	getcon(nettt);
	obj = document.getElementById("evtlayer");
	//alert(obj);
	if(showno == 1)
	{
		obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this) class=mit id='first1'>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 0)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)' id='first1' class=mit>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 2)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this) >Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)' id='first1' class=mit>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 3)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)' >Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)' id='first1' class=mit>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 4)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)' >Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)' id='first1' class=mit>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 5)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)' id='first1' class=mit>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 6)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)' id='first1' class=mit>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 7)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'  id='first1' class=mit>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 8)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'  id='first1' class=mit>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'>Agon</a>";
	}
	if(showno == 9)
	{
			obj.innerHTML = "<a href='javascript:void(0)' onClick=changelist(1,this)>Automatons</a><a href='javascript:void(0)' onClick='changelist(0,this)'>Antikytheria</a> <a href='javascript:void(0)' onClick='changelist(2,this)'>Exhibition</a> <a href='javascript:void(0)' onClick='changelist(3,this)'>Management</a> <a href='javascript:void(0)' onClick='changelist(4,this)'>Mechmania</a> <a href='javascript:void(0)' onClick='changelist(5,this)'>Quiz</a> <a href='javascript:void(0)' onClick='changelist(6,this)'>Trinity</a> <a href='javascript:void(0)' onClick='changelist(7,this)'>Guest Lectures</a> <a href='javascript:void(0)' onClick='changelist(8,this)'>Workshops</a> <a href='javascript:void(0)' onClick='changelist(9,this)'   id='first1' class=mit>Agon</a>";
	}
	document.getElementById("evt1layer").innerHTML = evtlist[showno];
	
}

function regpt(obj)
{
//	obj = document.getElementById("addpp");
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etid = obj.evtid.value;
	etname = obj.evt.value;
	url = "regevt.php?type=regpt&pt="+pt+"&etsize="+etsize+"&etname="+etname+"&etid="+etid;
	httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	return false;

	
	
}
var httpc = getHTTPObject();

function addpt(obj,tid)
{
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etid = obj.evtid.value;
	url = "regevt.php?type=addpt&pt="+pt+"&etsize="+etsize+"&tid="+tid+"&etid="+etid;
	httpc = getHTTPObject();
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	return false;

}

function regevtResponse() 
{   
	if(httpc.readyState == 4) 
	{
		if(httpc.status==200)
		{
			i = 0;
		   while(linknt[i].indexOf("Register") == -1)
		   {
			   i++;
		   }
		   rt = httpc.responseText;
		   document.getElementById('mainevtcontent').innerHTML = rt;
		   contnt[i] = rt;
		}
		else
		{
			document.getElementById('mainevtcontent').innerHTML = httpc.status;
		}
   }
}


function remove(em,tid,etid)
{
	
	url = "regevt.php?type=remove&email="+em+"&tid="+tid+"&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	
}

function removeself(tid,etid)
{
	url = "regevt.php?type=removeself&tid="+tid+"&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
}

function regself(etid)
{
	url = "regevt.php?type=regself&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
}

/*xceed*/
function xregpt(obj)
{
//	obj = document.getElementById("addpp");
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etid = obj.evtid.value;
	loc = obj.xloc.value;
	etname = obj.evt.value;
	url = "regevt.php?type=regpt&pt="+pt+"&etsize="+etsize+"&xloc="+loc+"&etname="+etname+"&etid="+etid;
	httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	return false;
	
	
}


function xaddpt(obj,tid)
{
	pt = obj.plist.value;
	etsize = obj.evtsize.value;
	etid = obj.evtid.value;
	url = "regevt.php?type=addpt&pt="+pt+"&etsize="+etsize+"&tid="+tid+"&etid="+etid;
	httpc = getHTTPObject();
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	return false;
}

function xregevtResponse() 
{   
	if(httpc.readyState == 4) 
	{
		if(httpc.status==200)
		{
			i = 0;
		   while(linknt[i].indexOf("Register") == -1)
		   {
			   i++;
		   }
		   rt = httpc.responseText;
		   document.getElementById('mainevtcontent').innerHTML = rt;
		   contnt[i] = rt;
		}
		else
		{
			document.getElementById('mainevtcontent').innerHTML = httpc.status;
		}
   }
}


function xremove(em,tid,etid)
{
	
	url = "regevt.php?type=remove&email="+em+"&tid="+tid+"&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
	
}

function xremoveself(tid,etid)
{
	url = "regevt.php?type=removeself&tid="+tid+"&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
}

function xregself(etid)
{
	url = "regevt.php?type=regself&etid="+etid;
    httpc.open("GET",url,true);
    httpc.onreadystatechange = xregevtResponse;
    httpc.send(null);
}

function getcontact(evt)
{

	while(evt.indexOf("_") != -1)
		evt = evt.replace("_"," ");

	var urlst="event.php?evt="+evt;	

	
	eventname=evt;
	httpv.open("GET",urlst,true);
    httpv.onreadystatechange = handleHttpResponsecont;
    httpv.send(null);
}

function handleHttpResponsecont() 
{   
	if(httpv.readyState == 4) 
	{
    	if(httpv.status==200)
		{
		
        	var results=httpv.responseText;
			document.getElementById("listcontainer").innerHTML = results;
					
        }
   }
   if(httpv.readyState == 1)
   {
		
		document.getElementById('listcontainer').innerHTML = "Loading...";
		//loadframe(eventname);


	
   }
}

function getcontact1(evtn,obj)
{
	if(!prev1)
	{
		prev1 = document.getElementById("first1");
	}
	if(prev1.innerHTML != obj.innerHTML)
	{
		prev1.setAttribute("class","");
		prev1.className="";
		prev1 = obj;
		prev1.setAttribute("class","mit");
		prev1.className="mit";
		getcontact(evtn);	
	}


}

function xceedload()
{
	fixpng();
	getcon("XCEED");
}


score = new Array();
score[0]=0;
score[1]=0;
score[2]=0;

function createXMLHttpRequest() {
	var xmlhttp;
	if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function processajax (serverPage,i,value){
	xmlhttp = createXMLHttpRequest();
	var obj = document.getElementById('submit'+i);
	xmlhttp.open("GET", serverPage+"?i="+i+"&v="+value);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = '<span  style="background:#CCCCCC">Thank you!</span>';
		}
	}
	xmlhttp.send(null); 
}

function setvalue(id)
{
	var r = Math.floor(id/5);
	score[r] = (id%5)+1;
	var s = r*5;
	var e = s+5;
	for( i=id;i<e;i++ ) {
		document.getElementById(i).src = "images/blank.jpg"; 
	}
	for( j=s;j<=id;j++ ) {
		document.getElementById(j).src = "images/filled.jpg"; 
	}	
}

function votefor(i)
{
	processajax("storevote.php",i,score[i]);
}
		
