function ChkForm(TheForms)
	{
	FormFildsChk = Array('text','textarea','file')
	for (var i = 0; i < TheForms.elements.length; i++) 
		{
		for (var t = 0; t < FormFildsChk.length; t++) 
			{
			if (TheForms.elements[i].type == FormFildsChk[t])
				{
				FieldsX = TheForms.elements[i].title.split('|')
				if (FieldsX[0] == 1 && TheForms.elements[i].value.replace(/ /gi,'') == '')
					{
					txbox = 'Please Complete Fileds :: ' + FieldsX[1] + ' !!'
					TheForms.elements[i].focus();
					alert(txbox)
					return false;
					}
				break;
				}
			}
		}
	return true
	}
function check_null(str)
	{
	if (str.replace(/ /gi,'')!='') {return true} else {return false}
	}
function CreateWindow(OPName,OPLink,OPWidth,OPHeight,OPScroll,OPStatus)
	{
	Nwin=window.open(OPLink,OPName,'scrollbars=' + OPScroll + ',width=' + OPWidth + ',height=' + OPHeight + ',left=10,top=10,status=' + OPStatus)
	if (typeof(f)!='object') 
		{
		f=Nwin
		} 
	else 
		{ 
		if (typeof(f.name)!='string') 
			{
			f=Nwin
			}
		else
			{ 
			if (f.name!=OPName) 
				{
				f=Nwin
				}
			else 
				{
				f.close()
				Nwin=window.open(OPLink,OPName,'scrollbars=' + OPScroll + ',width=' + OPWidth + ',height=' + OPHeight + ',left=10,top=10,status=' + OPStatus)
				}
			}
		}
	}
function CheckParStatus(nCount)
    {
	if (window.opener.closed==true)
		{
		window.close();
		}
	nCount = nCount + 1;
	speed = 100;
	TimeOuts = 0;
	nTime = new Date();
    TimeOuts=window.setTimeout('CheckParStatus(' + nCount + ')',speed);
	}
function InputNumOnly()
{
if (event.keyCode >= 48 && event.keyCode <= 57 || event.keyCode == 8 || event.keyCode == 46)
	{
	event.returnValue = true;
	}
	else
	{
	alert('Input Numeric Only ... ')
	event.returnValue = false;
	}
}
function ConSvalidate(p,c,co)
{
	//-------------------------------------
	//function to verify container number
	//Converted by DemanX 02/03/2004 dd/mm/yyyy
	//p  -> prefix
	//c  -> container no
	//co -> code
	//usage : validate("MSCU",123456,2);
	//result: true or false
	//-------------------------------------
	if (check_null(p)==true)
		{
		var chrx = '';
		var resx = 0;
		var resultx = 0;
		var resulty = 0;
		p=p.toUpperCase();
		for (var x=0;x<p.length;x++)
		{
			chrx=eval("'"+p+"'.substr("+x+",1)");
			resx=eval("1+(("+chrx.charCodeAt(0)+"-56)+Math.floor(("+chrx.charCodeAt(0)+"-56)/10))");
			resultx+=x==0?resx:Math.pow(2,x)*resx;
		}
		for (var x=0;x<=c.toString().length;x++)
		{
			resulty+=Math.pow(2,(x+4))*c.toString().substr(x,1);
		}
		chrx=(parseInt((resultx+resulty)%11));
		return chrx==co?true:false;
		}
		else
		{
		return false;
		}
}
function isValidTime (myTime) 
{
// checks if time passed is in valid h/m/s format
    if (myTime.length != 0) 
	{
		arrTime = myTime.split(':')
		if (arrTime.length == 3)	
		{
			var hour = parseInt(arrTime[0])
			var minute = parseInt(arrTime[1])
			var second = parseInt(arrTime[2])

			if (hour >= 0 && hour <= 24 && minute >=0 && minute <=60 && second >=0 && second <= 60)
			{
				return true;
			}
			else
			{
				return false;
			}
        }
        else 
		{
            return false;
        }
    }
    else 
	{
        return false;
    }
}
function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail Address .. Please Check Again")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail Address .. Please Check Again")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	   alert("Invalid E-mail Address .. Please Check Again")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	   alert("Invalid E-mail Address .. Please Check Again")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	   alert("Invalid E-mail Address .. Please Check Again")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	   alert("Invalid E-mail Address .. Please Check Again")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	   alert("Invalid E-mail Address .. Please Check Again")
		return false
	 }

	 return true					
	}

