/****************************************************************************************************************************************
									function.js Created by Florentine Design Group 6th February 2005
****************************************************************************************************************************************/
function set_check_box(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 is_empty(theForm,theElement,theMsg)
{
	if(eval("window.document."+theForm+"."+theElement+".value")=="") {
		alert("" + theMsg + " can not be blank    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	}
}
function is_email(theForm,theElement,theMsg) {
	var str=eval("window.document."+theForm+"."+theElement+".value");
	if(str=="")	{
		alert(""+theMsg+" can not be blank    ");
		eval("window.document."+theForm+"."+theElement+".focus()");
		return false;
	} else	{
		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 delete_something(theURL,theValue,theMsg) 
{
	var str="Are you sure to delete this "+theMsg+" : "+theValue+" ?    ";
	choice=confirm(str);
	if(choice) {
		window.location.href=theURL;
	} else {
		return false;
	}
}
function set_combo(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 new_window(theURL,windowName,theStatus) {
	theStatus+=",toolbar=0,status=1,scrollbars=1,menubar=0,resizable=0";
	window.open(theURL,windowName,theStatus);
}
function check_file_field(theForm,theElement,theValue,theOption) {
	var fileVal=eval("window.document."+theForm+"."+theElement+".value");
	if(theOption=="New") {
		if(fileVal=="")	{
			alert("Please provide a "+theValue+" Image    ");
			eval("window.document."+theForm+"."+theElement+".focus()");
			return false;
		}
		var ext=fileVal.substr(fileVal.lastIndexOf(".")).toLowerCase();
		if(ext!=".gif" && ext!=".jpeg" && ext!=".png" && ext!=".jpg") {
			alert("This is not an image file ! Please verify    ");
			eval("window.document."+theForm+"."+theElement+".focus()");
			eval("window.document."+theForm+"."+theElement+".select()");
			return false;
		}
	} else {
		if(fileVal!="") {
			var ext=fileVal.substr(fileVal.lastIndexOf(".")).toLowerCase();
			if(ext!=".gif" && ext!=".jpeg" && ext!=".png" && ext!=".jpg") {
				alert("This is not an image file ! Please verify    ");
				eval("window.document."+theForm+"."+theElement+".focus()");
				eval("window.document."+theForm+"."+theElement+".select()");
				return false;
			}	
		}
	}
}
function change_password(theForm,OldElement,NewElement,ConfElement) 
{
	var OldValue=eval("window.document."+theForm+"."+OldElement+".value");
	var NewValue=eval("window.document."+theForm+"."+NewElement+".value");
	var ConfValue=eval("window.document."+theForm+"."+ConfElement+".value");
	if(OldValue=="" || NewValue=="" || ConfValue=="") {
		alert("Any password field can not blank    ");
		return false;
	} else {
		if(NewValue!=ConfValue) {
			alert("New Password and Confirm Password should be same    ");
			eval("window.document."+theForm+"."+ConfElement+".focus()");
			eval("window.document."+theForm+"."+ConfElement+".select()");
			return false;
		}
	}
}