<!--


function Send(form) {
	target_form=document.forms[form];
	//if (form=='NewMessage') target_form.action='?section='+REQUEST['section']+'&sub=sent';
	target_form['submitted'].value=1;
	target_form.submit();
}

function AdmissionContinue(form) {
	target_form=document.forms[form];
	target_form.submit();
}

function DeleteCachedUpload(form,upload) {
	target_form=document.forms[form];
	target_form['delete_uploads'].value='file_'+upload;
	AdmissionContinue(form);
}

function elementFocus(form,element) {
	document.forms[form][element].focus();
}

function OpenVerificationCode() {
	var popup=window.open('/_images/images/card.gif','CARD','width=280,height=180,dependent=yes,location=no,menubar=no,resizable=no,toolbar=no,scrollbars=no');
}

function changeProductType() {
	document.forms['ProductType'].submit();
}

function changePayment() {
	
}

function toggleBonusCode(payment) {
	if (payment) {
  	target=document.getElementById('bonus_code');
  	if (payment=='1') target.innerHTML=window.payment_bonus_code;
  	else target.innerHTML='';
	}
}


function initPayment() {
	target_form=document.forms['Payment'];
	if (target_form['submitted'].value==0) {
  	target_form['payment'][0].checked=true;
  	highlightPrice(1);
	}
}

function switchPayment(bonuscode) {
	payment=document.forms['Payment']['payment'];
	if (bonuscode.length>0) {
		document.forms['Payment']['payment'][0].checked=true;
		highlightPrice(1);
	}
}

function applyBonusCode() {
	document.forms['Payment']['bonus_code_apply'].value='1';
	Send('Payment');
}

function emptyBonusCode() {
	if (document.forms['Payment']['bonus_amount'].value=='') document.forms['Payment']['bonus_code'].value='';
}

function disableInstallment() {
	document.forms['Payment']['payment'][1].disabled=true
}

function highlightPrice(payment) {
	if (document.forms['Payment']['bonus_amount'].value=='' || payment=='0') {
  	for (var i=1;i<=2;i++) {
			target=document.getElementById('price'+i);
			if (i==payment) target.style.fontWeight='bold';
			else target.style.fontWeight='';
		}
	}
}

function toggleMethodData(method) {
	if (method) {
  	target=document.getElementById('method_data');
  	target.innerHTML=window.payment_method_data['0']+window.payment_method_data[method];
	}
}
function confirmcheckbox() {
	if (document.form1.confirm.checked) {
	AdmissionContinue('form1');
	} else {
	alert ('Please confirm that you have read and understood the admission criteria!');
	}
}

function confirmfinal() {
	if (document.AdmissionStep3.confirm.checked) {
	AdmissionContinue('AdmissionStep3');
	} else {
	alert ('Please confirm that you have read, understood and accept the terms and conditions!');
	}
}


function togglecheckbox() {

	if (document.AdmissionStep3.scholarship.checked) {
  	target=document.getElementById('method_data');
  	target.innerHTML=window.payment_method_data['0'];
	} else
	{
  	target=document.getElementById('method_data');
  	target.innerHTML='';			
	}
}

var DateSelector={

	init:
	function(config) {
	
		var now=new Date();

    this.form=document.forms[config[0]];
    this.year=this.form[config[1]];
    this.month=this.form[config[2]];
    this.day=this.form[config[3]];
		
		/*
		this.range= new Array(now.getFullYear()-80,now.getFullYear()-15);
			this.fillDateBox(this.year);
		this.range= new Array(1,12);
			this.fillDateBox(this.month);
		this.range= new Array(1,31);
			this.fillDateBox(this.day);
		*/
	},

	fillDateBox:
	function(box) {
	
		with (box) {
      options[0] = new Option('Day','');
    	var a=1;
			for(var b=this.range[0];b<=this.range[1];b++) {
        options[a] = new Option(b,b);
    		a++;
    	}
		}
		
	},
	
	update:
  function() {
	  	
    var dayselindex = this.day.selectedIndex;

    timeA=new Date(this.year.value, this.month.value,'1');
    timeB=new Date(timeA - 86400000);
    var daysInMonth=timeB.getDate();
  	 
    for (var i = 0; i < this.day.length; i++) {
    	this.day.options[i] = null;
    }
		
    this.range= new Array(1,daysInMonth);
    	this.fillDateBox(this.day);
    this.day.options[dayselindex].selected = true;
  }
}

function Login() {
	document.forms['Login'].action='/login.php';
	document.forms['Login'].submit();
}

function openScholarship() {
  scholarship=window.open('/_popup/scholarship/','SHORTCUT','width=570,height=500,scrollbars=no,menubar=no,toolbar=no,statusbar=no,dependent=yes,location=no,resizable=no');
  scholarship.focus();
  window.location.href='/?section=distancelearning&sub=admission';
}

function parentGetURL(url) {
	window.opener.location.href=url;
}

//-->