/**********************************************************************************************
	              function.js Created by Subhasish Nag 6th February 2005
**********************************************************************************************/

function check_click(check) {
	var sus= document.getElementById(check).checked;

	if(sus == true)
	{
		setCheckBox('frm2',true);
	}
	else if(sus == false)
	{
		setCheckBox('frm2',false);
	}

}


function setCheckBox(theForm,theStatus) {
	var sus=eval("window.document."+theForm+".elements.length");
	for(j=0;j<sus;j++) {
		if(eval("window.document."+theForm+".elements["+j+"].type")=="checkbox") {
			eval("window.document."+theForm+".elements["+j+"].checked="+theStatus);
		}
	}
}
function getDeleteConfirm(theURL,theValue,theMsg) {
	var str="Are you sure you want to delete this "+theMsg+" : "+theValue+" ?    ";
	choice=confirm(str);
	if(choice) {
		window.location.href=theURL;
	} else {
		return false;
	}
}
function CheckFileField(theForm,theElement,theValue) {
	var fileVal=eval("window.document."+theForm+"."+theElement+".value");
	if(fileVal=="")	{
		alert("Please provide a "+theValue+" file    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	}
	var ext=fileVal.substr(fileVal.lastIndexOf(".")).toLowerCase();
	if(ext!=".csv") {
		alert("Upload file should be .csv format    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		eval("window.document."+theForm+"."+theElement+".select()");
		return false;
	}
}
function isEmpty(theForm,theElement,theMess) {
	var str=eval("window.document."+theForm+"."+theElement+".value");
	if(str=="") {
		alert(""+theMess+" should not be empty    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	}
}
function IsNumeric(theForm,theElement,theMess) {
	var str=eval("window.document."+theForm+"."+theElement+".value");
	if(str=="") {
		alert(""+theMess+" should not be empty    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	}
	if(isNaN(str)==true || parseInt(str) <= 0) {
		alert(""+theMess+" should not be alpha numeric and always greater than Zero    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		eval("window.document."+theForm+"."+theElement+".select()");
		return false;
	}
}
function isEmail(theForm,theElement,theMess) {
	var str=eval("window.document."+theForm+"."+theElement+".value");
	if(str=="") {
		alert(""+theMess+" should not be empty !!! Please provide a valid email address    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	}
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
	if(re.test(str)==false) {
		alert("That is not a valid Email address. Please enter again.    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		eval("window.document."+theForm+"."+theElement+".select()");
		return false;
	}
}
function isSpecialChar(theForm,theElement,theMsg) {
	var iChars = "!@#$%^&*~`()+=-[]\\\';,/{}|\":<>?";
	for(var i=0;i<eval("window.document."+theForm+"."+theElement+".value.length");i++) {
		if(iChars.indexOf(eval("window.document."+theForm+"."+theElement+".value.charAt("+i+")"))!=-1) {
			alert(theMsg);
			eval("window.document."+theForm+"."+theElement+".focus()");
			eval("window.document."+theForm+"."+theElement+".select()");
			return false;
		}
	}
}
function setCombo(theForm,theElement,theMess) {
	var str=eval("window.document."+theForm+"."+theElement+".selectedIndex");
	if(str==0) {
		alert("Please select a value for "+theMess+"    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false
	}
}
function _doPagination(page,query) {
	var d = window.document;
	var str = d.getElementById('cmbPage')[d.getElementById('cmbPage').selectedIndex].value;
	if(query == "") {
		window.location.href = page + "?page=" + str;
	} else {
		window.location.href = page + "?page=" + str + "&" + query;
	}
}
function LoadPopup(getFileName,getWindowName,getHeight,getWidth) {
	var _file = getFileName;
	var _window = getWindowName;
	var _toolbar = 0;
	var _menubar = 0;
	var _status = 1;
	var _resizable = 1;
	var _width = getWidth;
	var _height = getHeight;
	var _top = (screen.height - _height) / 2;
	var _left = (screen.width - _width) / 2;
	var _scrollbars = 1;

	var _condition = "toolbar=" + _toolbar + ",menubar=" + _menubar + ",status=" + _status + ",resizable=" + _resizable;
	_condition+=",width=" + _width + ",height=" + _height + ",left=" + _left + ",top=" + _top + ",scrollbars=" + _scrollbars + "";

	window.open(_file,_window,_condition);

	/*var screenwidth = _width;
	var screenheight = _height;
	var myparams = "left=" + _left;
	myparams += ",top=" + _top;
	myparams += ",width=10,height=10";
	myparams += ",toolbar=no,menubar=no,location=no";
	myparams += ",status=yes,scrollbars=yes,resizable=yes"
	var mywindow=open(_file,_window, myparams);

	var resizesteps = 50;
	var myx = 10
	var myy = 10;
	var widthspeed = (screenwidth-100)/resizesteps;
	var heightspeed = (screenheight-100)/resizesteps;
	for (size=0; size<resizesteps; size++){
	mywindow.resizeTo(myx, myy);
	myx += widthspeed;
	myy += heightspeed;}
	mywindow.resizeTo(screenwidth, screenheight);*/
}
function _doInputNumberOnly() {
	if(event.keyCode < 46 || event.keyCode > 57) {
		event.returnValue = false;
	}
}
function modelessDialogShow(url,width,height) {
	window.showModelessDialog(url,window,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:1;help:0;resizable:1;");
}
function modalDialogShow(url,width,height) {
	window.showModalDialog(url,window,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:1;help:0;resizable:1;maximize:1");
}
function doTooltip(e, msg) {
	if(typeof Tooltip == "undefined" || !Tooltip.ready) return;
	Tooltip.show(e, msg);
}

function hideTip() {
	if(typeof Tooltip == "undefined" || !Tooltip.ready) return;
	Tooltip.hide();
}

function move(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		} else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
   		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
   	}
}

function popUpWindow(URLStr, left, top, width, height)
{
  var popUpWin=0;

	width =width+20;
	height=height+30;
  	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

function popUpWindow_templte(URLStr, left, top, width, height)
{
  var popUpWin=0;

	width =width+20;
	height=height+30;
  	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

// JavaScript Document

function over(a)
{
	var b = a.id;

	if(b =='')
	{
		a.id = "selected_id";
	}
	else
	{
		a.id = "selected";
	}
}

function out(a)
{
	var b = a.id;

	if(b =='selected_id')
	{
		a.id = "";
	}
}

function check_type()
{
		document.getElementById("graphics_type").style.display="none";
		document.getElementById("text_type").style.display="none";

		var a = document.apply_ads.type;
		var b = a.options[a.selectedIndex].value;

		switch(b){
			case "graphics" :
					document.getElementById("graphics_type").style.display="";
				break;

			case "text" :
					document.getElementById("text_type").style.display="";
				break;

			case "text & graphics" :
					document.getElementById("graphics_type").style.display="";
					document.getElementById("text_type").style.display="";
				break;
	}
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

function changeColor(str)
{
	var b = str.id;

	if(document.getElementById(b).checked == true)
		document.getElementById('st'+b).className ="selectedtr";
	else
		document.getElementById('st'+b).className ="";
}

function changeCountyColor(str)
{
	var d = str.id;

	if(document.getElementById(d).checked == true)
		document.getElementById('ct'+d).className ="selectedtr";
	else
		document.getElementById('ct'+d).className ="";
}











































































































































































































































































































































































































