// checks for file extension create by Gautam 8th may 2006
// this script checks file extensions and reurns the following
// 0 if it does not match with allowed extension
// 1 if it matches
// 2 if file name passed was blank


function pageHandler(url){
//var URL = document.pagescounter.site.options[document.pagescounter.site.selectedIndex].value;
window.location.href=url;
}


function is_ext_Valid(fileName,allowedExt)
{
	fileName = fileName.toLowerCase();
	if(fileName.length < 5)
	{
		return 2;
	}
	else
	{
		var extensions;
		extensions = allowedExt.toLowerCase();
		var strLen = fileName.length;
		strLen = strLen - 4;
		//get the extension of file
		var fileExt = fileName.substr(strLen,4);
		
		var extArr =extensions.split(",");
		var i;
		var status;
		for(i in extArr)
		{
			if(fileExt.match(extArr[i]))
			{	
				status = "ok";
				break;				
			}
		}
		
		if(status == "ok")
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}
}

//////////job




function checkAll(formname)
{
	len=formname.elements.length;
	var i=0;
	for(i=0;i<len;i++)
	{
		if(formname.elements[i].type=='checkbox')
		{
			formname.elements[i].checked=1;
		}
	}
}

function uncheckAll(formname)
{
	len=formname.elements.length;
	var i=0;
	for(i=0;i<len;i++)
	{
		if(formname.elements[i].type=='checkbox')
		{
			formname.elements[i].checked=0;
		}
	}
}
function csv_file_check(){
	
	allowedExt = ".csv";
		varRet = is_ext_Valid(document.SaveForm.file1.value,allowedExt);
		if(varRet == 0)
		{
		alert("Only the following extension are allowed" + allowedExt);
		return false;
		}
	
	
}
function SubmitForm()
{
allowedExt = ".gif,.jpg";
		varRet = is_ext_Valid(document.SaveForm.file1.value,allowedExt);
		if(varRet == 0)
		{
		alert("Only the following extension are allowed" + allowedExt);
		return false;
		}
			varRet = is_ext_Valid(document.SaveForm.file2.value,allowedExt);
			if(varRet == 0)
			{
			alert("Only the following extension are allowed" + allowedExt);
			return false;
			}
		varRet = is_ext_Valid(document.SaveForm.file3.value,allowedExt);
		if(varRet == 0)
		{
		alert("Only the following extension are allowed" + allowedExt);
		return false;
		}
			varRet = is_ext_Valid(document.SaveForm.file4.value,allowedExt);
			if(varRet == 0)
			{
			alert("Only the following extension are allowed" + allowedExt);
			return false;
			}
	varRet = is_ext_Valid(document.SaveForm.file5.value,allowedExt);
	if(varRet == 0)
	{
	alert("Only the following extension are allowed" + allowedExt);
	return false;
	}
			varRet = is_ext_Valid(document.SaveForm.file6.value,allowedExt);
			if(varRet == 0)
			{
			alert("Only the following extension are allowed" + allowedExt);
			return false;
			}

}
function docheck() {
	var abc = confirm("Do you really want to delete this record?");
	
if(abc) {
	
	} else {
		return false;
	}
}

function docheckmail() {
	var abcd = confirm("Do you really want to Send mail to them?");
	
if(abcd) {
	
	} else {
		return false;
	}
}

function messagesend(id){	
window.location.href='payment_to_seller.php?id='+id;
}




