// JavaScript Document

function showloading(div){
	if (div == undefined){
	   	div = 'dLoad';
 	}
	var msg = '<table width="200" height="17" border="0" cellpadding="0" cellspacing="0"><tr><td width="24"><img src="images/loading.gif" width="16" height="20" /></td>                                  <td width="203" align="left" valign="middle" class="red">Please wait loading....</td> </tr></table>';	
	document.getElementById(div).innerHTML = msg ;	
}

function hideloading(div){
	if (div == undefined){
	   	div = 'dLoad';
 	}
	document.getElementById(div).innerHTML = '&nbsp;' ;
}
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=640,height=600,left = 240,top = 212');");
}
function invoice(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=700,left = 240,top = 212');");
}

function FillDropDownRep(str,obj){
	var cat = new Array();
	var catid; //= new Array();
        	
	cat = str.split('^');
    obj.innerHTML = "";
        	
	var option1 = document.createElement('option');
	option1.appendChild(document.createTextNode("- Select Course -"));
	option1.setAttribute('value', "0");
	obj.appendChild(option1);
	        
    for(var x = 1; x < (cat.length-1); x+=2) 
	{
		//alert(cat[x]);
		var option = document.createElement('option');
		option.appendChild(document.createTextNode(cat[x]));
		x++;
		option.setAttribute('value', cat[x]);
		obj.appendChild(option);
	}
	option1 = document.createElement('option');
	option1.appendChild(document.createTextNode("Add Course >>"));
	option1.setAttribute('value', "more");
	obj.appendChild(option1);
}


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}