function popup(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'width=550,height=520,scrollbars=yes,resizable=yes');
return false;
}

function ignowpopup(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'width=800,height=685,scrollbars=yes');
return false;
}

function gallerypopup(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'width=500,height=328,scrollbars=no');
return false;
}


function copyRight(startYear) {	
    date = new Date();
    year = date.getYear();
    if ( (year - startYear) > 0){
       document.write(startYear + " - " + year);
    }else{
     document.write(startYear);
    } 
}

function clearfrm()
	{
			document.careerfrm.reset();
			document.feedback.reset();
			document.request.reset();
			
	}

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 ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function trimString(testString)
		{
			   testString = testString.replace(/^\s+/, '');
			   testString = testString.replace(/\s+$/, '');
			   return testString;	
		}
		
function onsaving()
		{

				if(trimString(document.careerfrm.tname.value)=="")
				{
					alert("Pls Enter Applicant Name");
					document.careerfrm.tname.focus();
					return false;
				}			
	
				if(trimString(document.careerfrm.temailid.value)=="")
				{
					alert("Pls Enter eMaild ID");
					document.careerfrm.temailid.focus();
					return false;
				}

				if (echeck(document.careerfrm.temailid.value)==false)
				{					
					document.careerfrm.temailid.focus();
					return false;
				}
				
//				if(trimString(document.careerfrm.upload.value)=="")
//				{
//					alert("Pls attach Resume");
//					document.careerfrm.mailid.focus();
//					return false;
//				}
//				if(trimString(document.careerfrm.upload.value)=="")
//				{
//					alert("Pls attach Resume ");
//					document.careerfrm.message.focus();
//					return false;
//				}
				
				document.careersfrm.action="resumeupload.asp";
				document.careersfrm.submit();
				return true;
			
		}
		
		
function onsaving_feedback()
		{		
				if(trimString(document.feedback.tname.value)=="")
				{
					alert("Pls Enter Name");
					document.feedback.tname.focus();
					return false;
				}		
				
				if(trimString(document.feedback.temailid.value)=="")
				{
					alert("Pls Enter eMaild ID");
					document.feedback.temailid.focus();
					return false;
				}
				
				if (echeck(document.feedback.temailid.value)==false)
				{					
					document.feedback.temailid.focus();
					return false;
				}
				
				if(trimString(document.feedback.tcomments.value)=="")
				{
					alert("Pls Enter Comments");
					document.feedback.tcomments.focus();
					return false;
				}			
				document.feedback.action="sendemail.php";
				document.feedback.submit();
				return true;
		}
		
function onsaving_request()
		{		
				if(trimString(document.request.rname.value)=="")
				{
					alert("Pls Enter Name");
					document.request.rname.focus();
					return false;
				}
				if(trimString(document.request.remailid.value)=="")
				{
					alert("Pls Enter eMaild ID");
					document.request.remailid.focus();
					return false;
				}
				
				if (echeck(document.request.remailid.value)==false)
				{					
					document.request.remailid.focus();
					return false;
				}
				
/*				if(trimString(document.request.products.value)=="")
				{
					alert("Pls Select any Product");
					document.request.products.focus();
					return false;
				}
*/
				document.request.action="thankyou-request.php";
				document.request.submit();
				return true;
				
		}