var xmlHttp;

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 ajxRequest(url) {
	//alert(url);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
	{
		alert ("Sorry, your browser does not support AJAX!");
		return;
	}

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			//if (xmlHttp.responseText == 2) get_element('filterdiv').innerHTML='';
			//alert(xmlHttp.responseText);
		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}





function blinkIt() {
	if (!document.all) return;
	else {
		for(i=0;i<document.all.tags('blink').length;i++){
			s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
		}
	}
}

function get_element(id) {
	if (document.getElementById) return document.getElementById(id);
	else if (document.all) return document.all[id];
	else return false;
}

function show_unshow_element(id) {
	element = get_element(id);
	if (element == false) return 0;
	//alert (element.style.display);
	if (element.style.display=='block' || element.style.display=='')
	element.style.display='none';
	else element.style.display='block';
	//else if (document.all) document.all[id].style.display='block';
}

function show_unshow_element_array(prefix,count) {
	for (i = 0; i < count; i++) {
		//alert (prefix);
		//alert (i);
		show_unshow_element(prefix + i);
	}
}

function color_div (pole,id,kolko) {
	var col1 = '#ddd';
	var col2 = 'transparent';
	for (i=1;i<kolko+1;i++)
	{


		var co = pole;
		if (co+i == id)
		{
			//alert (id);
			if (document.getElementById) {
				document.getElementById(id).style.backgroundColor=col1;
			}
			else if (document.all) {
				document.all[id].style.backgroundColor=col1;
			}
		}
		else
		{
			//alert (co+i);
			if (document.getElementById) {
				document.getElementById(co+i).style.backgroundColor=col2;
			}
			else if (document.all) {
				document.all[co+i].style.backgroundColor=col2;
			}
		}
	}
	/*
	if (document.getElementById) {
	document.getElementById(id).style.display=col1;
	}
	else if (document.all) {
	document.all[id].style.display=col1;
	}
	*/

}


function show_div(pole,id,kolko) {
	//var program = array ('program1','program2','program3','program4', 'program5','program6','program7','program8','program9');

	for (i=1;i<kolko+1;i++)
	{

		var co = pole;
		if (co+i == id)
		{
			//alert (id);
			if (document.getElementById) {
				document.getElementById(id).style.display='block';
			}
			else if (document.all) {
				document.all[id].style.display='block';
			}
		}
		else
		{
			//alert (co+i);
			if (document.getElementById) {
				document.getElementById(co+i).style.display='none';
			}
			else if (document.all) {
				document.all[co+i].style.display='none';
			}
		}
	}

	//if (in_array(id,pole) ) alert ("aaaa");
	if (document.getElementById) {
		document.getElementById(id).style.display='block';
	}
	else if (document.all) {
		document.all[id].style.display='block';
	}
}

function unshow_div(id) {
	if (document.getElementById) document.getElementById(id).style.display='none';
	else if (document.all) document.all[id].style.display='none';
}


function confirmSubmit(txt)
{
	if (!txt) txt = "Do you want to continue?";
	var agree=confirm(txt);
	if (agree)
	return true ;
	else
	return false ;
}


function mouse_over(what) {
	forWhat = "img/butt/"+what.id+"_1.gif";
	what.src = forWhat;
	//if (document.getElementById) document.getElementById(what).src='';
	//else if (document.all) document.all[what].style.visibility='visible';
}

function mouse_out(what){
	forWhat = "img/butt/"+what.id+"_0.gif";
	what.src = forWhat;
}


function new_window(pict,name,width,height) {
	b=new_window.arguments;
	title = "";
	msgWindow=window.open("","displayWindow","menubar=no,scrollbars=no,width="+b[2]+",height="+b[3]+",top=130,left=30")
	msgWindow.document.write("<html><head><title>"+title+""+name+"</title><style>body {text-align:center;margin: 0px 0px 0px 0px;padding: 0px 0px 0px 0px;background-color:white;}</style></head>")
	msgWindow.document.write("<body><a href=javascript:window.close();><img align='center' src="+b[0]+" xwidth="+b[2]+" xheight="+b[3]+" alt=\"Click to Close Window\" title=\"Click to Close\" border=0></a>")
	msgWindow.document.write("</body></html>")
}

MenuImage = new Array();
MenuImage[0] = new Image();
MenuImage[0].src = "";

function calculate(value)
{
	sum = value * 100 + 150;
	if (document.layers)
	{
		document.layers["amount"].value = sum;
	}
	else if (document.all)
	{
		document.all["amount"].value = sum;
	}
	else if (document.getElementById)
	{
		document.getElementById("amount").value = sum;
	}
}

function calculateSessions(value)
{
	if ( value < 3 ) valuePerSession = 120;
	else valuePerSession = 100;
	
	sum = value * valuePerSession;
	if (document.layers)
	{
		document.layers["amount"].value = sum;
	}
	else if (document.all)
	{
		document.all["amount"].value = sum;
	}
	else if (document.getElementById)
	{
		document.getElementById("amount").value = sum;
	}
}

function checkform()
{
	name = document.all["os0"].value.length;
	dob = document.all["os1"].value.length;
	if (name > 0)
	{
		if (dob > 0)
		{
			document.payment.submit();
		}
		else
		{
			alert ("Please enter date of birth of the Student/Applicant you are paying for");
			return false;
		}
	}
	else
	{
		alert ("Please enter name of the Student/Applicant you are paying for");
		return false;
	}
}

