function submitForm(Form,url){
	
	Form.method = "post";
	Form.action = url+"/";
	Form.submit();
	
}
function submitRequest(Form){
if (trim(document.getElementById("request").value) == '') {
			strresult = 'request1';
			document.getElementById(strresult).style.display = "Block";
			document.getElementById(strresult).innerHTML = 'Please enter the web page address';
			document.getElementById("request").value = '';
			document.getElementById("request2").style.display = "none";
			return false;
		
		
	}else{
		document.getElementById("request2").style.display ="Block";
		return true;
	}
}
function validateEnquiry(Form) {

	flag = 0;
	var design='';
	var service='';
	var technology='';
	var others='';
	
		for(var i = 1; i<=6; i++){
			
			if(document.getElementById("chka"+i).className == "chk_on"){
				design =  design+document.getElementById("hdnDesign"+i).value +",";
						
			} 
			
		}document.getElementById("hdnDesign").value=design;
		
		for(var i = 1; i<=6; i++){
			
			if(document.getElementById("chka"+i).className == "chk_on"){
				service =  service+document.getElementById("hdnService"+i).value +",";
						
			} 
			
		}document.getElementById("hdnService").value=service;
		for(var i = 1; i<=6; i++){
			
			if(document.getElementById("chkb"+i).className == "chk_on"){
				technology =  technology+document.getElementById("hdnTechnology"+i).value +",";
			} 
		}document.getElementById("hdnTechnology").value=technology;
		for(var i = 1; i<=3; i++){
			
			if(document.getElementById("chkd"+i).className == "chk_on"){
				others =  others+document.getElementById("hdnOthers"+i).value +",";
						
			} 
		}document.getElementById("hdnOthers").value=others;
		
	var label = new Array('Full Name', 'Full Name','Mobile No','Email', 'Requirements','Attachment','Security Code','Yahoo','MSN','Gtalk','Skype','Others');
	var validationArray = new Array("", "name","phone","email", "","logo", "","name","name","name","name","name");
	
	for (i = 0; i <= 11; i++) {

		if (trim(document.getElementById("field" + i).value) == '') {

			if (i != 5  && i!=7 && i!=8 && i!=9 && i!=10 && i!=11) {

				strresult = 'id' + i;
				document.getElementById(strresult).style.display = "Block";
				document.getElementById(strresult).innerHTML = 'Please enter the ' + label[i];
				document.getElementById("field" + i).value = '';
				flag = 1;
			}
			
		} else if (applyValidation(validationArray[i], document
				.getElementById("field" + i).value)) {			
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "Block";
			if (i == 5) {
				document.getElementById(strresult).innerHTML = 'Please upload valid Attachement';
			} else {
				document.getElementById(strresult).innerHTML = 'Please enter valid ' + label[i];
			}
			flag = 1;

		}

		else {
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "none";
			
		}

	}
	
	if (flag == 1) {
		return false;
	} else if (flag == 0) {
		if(document.getElementById("loader")){
			document.getElementById("loader").style.display = "Block";
			document.getElementById("hidebutton").style.display = "none";
			}
		return true;
	}

}
function validateBug(Form) {

	flag = 0;
	var issue='';
	var exp='';
	
	
		for(var i = 1; i<=5; i++){
			
			if(document.getElementById("chk"+i).className == "rd_on"){
				issue =  document.getElementById("hdnIssue"+i).value ;
						
			} 
			
		}document.getElementById("hdnIssue").value=issue;
		
		for(var i = 1; i<=2; i++){
			
			if(document.getElementById("rd"+i).className == "rd_on"){
				exp =  document.getElementById("hdnExp"+i).value ;
						
			} 
			
		}document.getElementById("hdnExp").value=exp;
		
	
	var label = new Array('Web Page', 'Name','Email');
	var validationArray = new Array("", "name","email");

	for (i = 0; i <=2; i++) {

		if (trim(document.getElementById("field" + i).value) == '') {

				strresult = 'id' + i;
				document.getElementById(strresult).style.display = "Block";
				document.getElementById(strresult).innerHTML = 'Please enter the ' + label[i];
				document.getElementById("field" + i).value = '';
				flag = 1;
			
			
		} else if (applyValidation(validationArray[i], document
				.getElementById("field" + i).value)) {
			
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "Block";
			document.getElementById(strresult).innerHTML = 'Please enter valid ' + label[i];
			flag = 1;

		}

		else {
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "none";
			
		}

	}
	
	if(document.getElementById("FIELD3").value != '' ){
		if(applyValidation2(document.getElementById("FIELD3").value)){
			document.getElementById("ID3").style.display ="block";
			document.getElementById("ID3").innerHTML = 'No. of chars. should not exceed 500';
			document.getElementById("FIELD3").focus();
			return false;
			}else{
				document.getElementById("ID3").style.display ="none";
				document.getElementById("ID3").innerHTML = '';
				
			}
	}
	
	
	
	if(document.getElementById("field0").value==''){
		document.getElementById("field0").focus();
		return false;
	}
	else if(document.getElementById("field1").value==''){
		document.getElementById("field1").focus();
		return false;
	}
	else if(document.getElementById("field2").value==''){
		document.getElementById("field2").focus();
		return false;
	}
	
	
	if (flag == 1) {
		return false;
	} else if (flag == 0) {
		return true;
	}

}

function applyValidation2(field_val){ 
	if(field_val != ""){
		if(field_val.length >= 500){		
			return true;
		}
		else{				
			return false;
		}
	}
}
	
function validateCareer(Form) {
	flag = 0;
	var label = new Array('Name', 'Mobile Number','Email Address', 'Resume','Message');
	var validationArray = new Array("name","phone","email", "doc", "");

	for (i = 0; i <= 4; i++) {

		if (trim(document.getElementById("field" + i).value) == '') {

				strresult = 'id' + i;
				document.getElementById(strresult).style.display = "Block";
				if(i==3){
					document.getElementById(strresult).innerHTML = 'Please upload the ' + label[i];
				}else{
					document.getElementById(strresult).innerHTML = 'Please enter the ' + label[i];
					document.getElementById("field" + i).value = '';
					
				}
				
				flag = 1;
			
			
		} else if (applyValidation(validationArray[i], document
				.getElementById("field" + i).value)) {
			
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "Block";
			if (i == 3) {
				document.getElementById(strresult).innerHTML = 'Please upload valid Resume';
			} else {
				document.getElementById(strresult).innerHTML = 'Please enter valid ' + label[i];
			}
			flag = 1;

		}
				

		else {
			strresult = 'id' + i;
			document.getElementById(strresult).style.display = "none";
			
		}

	}

	if(document.getElementById("field0").value==''){
		document.getElementById("field0").focus();
		return false;
	}
	else if(document.getElementById("field1").value==''){
		document.getElementById("field1").focus();
		return false;
	}
	else if(document.getElementById("field2").value==''){
		document.getElementById("field2").focus();
		return false;
	}
	else if(document.getElementById("field3").value==''){
		document.getElementById("field3").focus();
		return false;
	}else if(document.getElementById("field4").value==''){
		document.getElementById("field4").focus();
		return false;
	}
	
	if (flag == 1) {
		return false;
	} else if (flag == 0) {
		return true;
	}

}


function applyValidation(arr_val, field_val) {

	if (arr_val == "") {
		return false;
	} else if (arr_val == "country") {
		if (field_val != "") {
			if (isName(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	}

	else if (arr_val == "logo") {
		
		if (field_val != "") {
			if (chkImage(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "doc") {
		if (field_val != "") {
			if (chkFile(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "link") {
		if (field_val != "") {
			if (chkLink(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "flv") {
		if (field_val != "") {
			if (chkVideo(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "large") {
		if (field_val != "") {
			if (chkImage(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "email") {
		if (field_val != "") {
			if (isEmail(field_val)) {
				return false;
			} else {
				return true;
			}
		}
	} else if (arr_val == "zip") {
		if (field_val != "") {
			if (isPhone(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	} else if (arr_val == "name") {
		if (field_val != "") {
			if (isName(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	}

	else if (arr_val == "state") {
		if (field_val != "") {
			if (isName(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	} else if (arr_val == "company") {
		if (field_val != "") {
			if (isCompany(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	}

	else if (arr_val == "num") {
		if (field_val != "") {

			if (isNumber(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	}

	else if (arr_val == "phone") {
		if (field_val != "") {
			if (isPhone(field_val)) {
				return false;
			} else {
				return true;
			}
		}

	}
}
function isNum(objField) {
	if (objField.match(/^\d+$|^\d+\.\d{1}$/)) {
		return true;
	}
	else {
		return false;
	}

}
function isNumber(objField) {
	
	if (/^[1-9]+$/.test(objField)) {

		return true;
	}
	else {
		return false;
	}

}

function chkImage(objField) {
	var imageval = objField;
	var len = imageval.length;
	var sublen = len - 3;
	var checkstr = imageval.substr(sublen);
	
	if (checkstr == "pdf" || checkstr == "doc" || checkstr == "xls") {
		return true;
	} else {
		return false;
	}

}
function chkLink(objField) {
	var my_str = objField;
	var str = "<embed";
	var str1 = "</embed>";
	var str2 = "<object";
	var str3 = "</object>";
	
	if (my_str.search(str) == -1 || my_str.search(str1) == -1
			|| my_str.search(str2) == -1 || my_str.search(str3) == -1) {
		return false;
	} else {
		return true;
	}

}
function chkFile(objField) {	
	var imageval = objField;
	var len = imageval.length;
	var sublen = len - 3;
	var checkstr = imageval.substr(sublen);
	if (checkstr == "doc") {
		return true;
	} else {
		return false;
	}

}
function chkVideo(objField) {
	var imageval = objField;
	var len = imageval.length;
	var sublen = len - 3;
	var checkstr = imageval.substr(sublen);
	if (checkstr == "flv") {
		return true;
	} else {
		return false;
	}

}
function isEmail(objField) {

	if (objField != 0) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isPhone(objField) {

	if (objField != 0) {
		if (/^([0-9-().]{6,18})$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isLoc(objField) {

	if (objField != 0) {
		if (/^([0-9-().])$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isTime(objField) {

	if (objField != 0) {
		if (/^[A-Za-z0-9 +-.]+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isName(objField) {
	if (objField != 0) {
		if (/^[a-zA-Z0-9._][ a-zA-Z0-9._]+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}

function isCompany(objField) {

	if (objField != 0) {
		if (/^[a-zA-Z1-9][ a-zA-Z0-9'-]+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isDays(objField) {

	if (objField != 0) {
		if (/^[A-Za-z0-9 -]+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}
function isAlphanum(objField) {

	if (objField != 0) {
		if (/^[a-zA-Z1-9]+$/.test(objField)) {
			return true;
		}
	} else {
		return false;
	}

}

function trim(name) {
	return name.replace(/^\s+|\s+$/g, "");
}


function alphanumeric(alphane) {

	//charAt return the character at specified position
	//charCodeAt return the unicode value of the characters
	var numaric = alphane;
	for ( var j = 0; j < numaric.length; j++) {
		var alphaa = numaric.charAt(j);
		var hh = alphaa.charCodeAt(0);
		if ((hh > 47 && hh < 58) || (hh > 64 && hh < 91)
				|| (hh > 96 && hh < 123) || (hh == 32)) {
		} else {
			return false;
		}
	}
	return true;
}

function spnumeric(alphane) {

	//charAt return the character at specified position
	//charCodeAt return the unicode value of the characters
	var numaric = alphane;
	for ( var j = 0; j < numaric.length; j++) {
		var alphaa = numaric.charAt(j);
		var hh = alphaa.charCodeAt(0);
		if ((hh > 47 && hh < 58) || (hh > 64 && hh < 91) || (hh == 32)) {
		} else {
			return false;
		}
	}
	return true;
}
function IsNumeric(strString) {
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

	if (strString.length == 0)
		return false;

	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}
/*validate for file extension*/
function validateFileExtension(fld) {
	if (!/(\.png|\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) {
		return true;
	}
	return false;
}
