
function f_trimmer(thisstring)
{
	while(thisstring.charAt(0)==" ")
	{
		thisstring=thisstring.substring(1,thisstring.length);
	}
	return thisstring;
}

function checkme(q_search_form){
	var ss = document.forms[q_search_form].keyword.value;
	if (ss.length<4){	
		 alert("The searched word must be minimum 4 characters!");
		 document.forms[q_search_form].keyword.focus();
		 return false;
	}
	var qw1 = document.getElementById("forjava1");
	//alert (qw1.value);
	var qw2 = document.getElementById("forjava2");
	//alert (qw2.value);
	//window.location="http://www."+qw1.value+"/search/0/"+qw2.value+"/0";
	document.forms[q_search_form].action="http://www."+qw2.value+"/search/"+qw1.value+"/0/0";
	return true;
}

function checkme2(myform){
if (document.myform.category_id){
	if (f_trimmer(document.myform.category_id.value)==""){
		 alert("Select a category");
		 
		 return false;
	}
}

if (document.myform.name){
	if (f_trimmer(document.myform.name.value)==""){
		 alert("Name is required");
		 document.myform.name.focus();
		 return false;
	}
}
if (document.myform.applicant){
	if (f_trimmer(document.myform.applicant.value)==""){
		 alert("Applicant Name is required");
		 document.myform.applicant.focus();
		 return false;
	}
}

if (document.myform.mail){
	
	if (f_trimmer(document.myform.mail.value)==""){
		alert("Email is required\n");
		document.myform.mail.focus();
		return false;
	} else {
   		var s = new String(document.myform.mail.value);

       	if ((s.indexOf(".")==-1 || s.indexOf("@")==-1)){       
       		alert ("Your Email address is invalid.");
			document.myform.mail.focus();
			return false;
		}
	}
}

if (document.myform.message){
	if (f_trimmer(document.myform.message.value)==""){
		alert("Write Us a message please!");
		document.myform.message.focus();
		
		return false;
	} 
}

if (document.myform.username){
	if (f_trimmer(document.myform.username.value)==""){
		alert("Username is required");
		document.myform.username.focus();
		
		return false;
	} 
}

if (document.myform.password){
	if (f_trimmer(document.myform.password.value)==""){
		alert("Password is required");
		document.myform.password.focus();
		
		return false;
	} else {
		if (f_trimmer(document.myform.password.value)!=f_trimmer(document.myform.password2.value)){
			alert("Password not confirmed");
			document.myform.password2.focus();
			return false;
		}
			
	}
}



if (document.myform.scode){
	if (f_trimmer(document.myform.scode.value)==""){
		alert("Security code not confirmed");
		document.myform.scode.focus();
		
		return false;
	} 
}




}