function __checkBrowserJs(){
	$('errorDiv').style.display = '';
//	$('erroImg').style.display = 'none';
}

function __showCV(val){
		if(val == 0){
			$('showCV').style.display = 'none';
			$('cvfilename').style.display = 'none';
			$('cv_file_2').value = '0';
		}else{
			$('showCV').style.display = '';
		}
	}
	
function passwordStrength(password)
{
	var desc = new Array();
	desc[0] = "Very Weak";
	desc[1] = "Weak";
	desc[2] = "Better";
	desc[3] = "Medium";
	desc[4] = "Strong";
	desc[5] = "Strongest";

	var score   = 0;

	//if password bigger than 6 give 1 point
	if (password.length > 6) score++;

	//if password has both lower and uppercase characters give 1 point	
	if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;

	//if password has at least one number give 1 point
	if (password.match(/\d+/)) score++;

	//if password has at least one special caracther give 1 point
	if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;

	//if password bigger than 12 give another 1 point
	if (password.length > 12) score++;

	 document.getElementById("passwordDescription").innerHTML = desc[score];
	 document.getElementById("passwordStrength").className = "strength" + score;
}


function __getVal(id){
		if(id == 0 ){
				$('greeting').style.display = 'none';
				$('hideTR').style.display = '';
			}else{
				$('greeting').style.display = '';
				$('hideTR').style.display = 'none';
				
				}
     var url = 'getcoverletter.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'id='+id; // greeting-name FILED KA NAAM
     var target = 'greeting'; // JIS DIV ME RESULT SHOW KARWANA HAI
     var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
	 
}

////// get cv file on apply job page
function __getCvFile(filename){
	
		if(filename == 0 ){
				$('cvfilename').style.display = 'none';
			}else{
				$('cvfilename').style.display = '';
				}
				
     var url = 'getcvfilename.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'filename='+filename; // greeting-name FILED KA NAAM
     var target = 'cvfilename'; // JIS DIV ME RESULT SHOW KARWANA HAI
     var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
	 
}


function __getValP(username){
     
	 $('greeting').style.display = '';
	 $('progressBar').style.display = '';
	 
	 var url = 'user_availability.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'username='+username; // greeting-name FILED KA NAAM
     var target = 'greeting'; // JIS DIV ME RESULT SHOW KARWANA HAI
     //var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
	var myAjax = new Ajax.Updater(target, url, {

                method: 'get', parameters: pars,
                onComplete: function(){
						$('progressBar').style.display = 'none';
					}

        }); 
}
function __getValP_changeusername(username,old_username){
     
	 $('greeting').style.display = '';
	 $('progressBar').style.display = '';
	 
	 var url = 'user_availability_change.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'username='+username+'&old_username='+old_username; // greeting-name FILED KA NAAM
     var target = 'greeting'; // JIS DIV ME RESULT SHOW KARWANA HAI
     //var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
	var myAjax = new Ajax.Updater(target, url, {

                method: 'get', parameters: pars,
                onComplete: function(){
						$('progressBar').style.display = 'none';
					}

        }); 
}
function __getValP1(email_address){
     
	 $('greeting1').style.display = '';
	 $('progressBar1').style.display = '';
	//alert(email_address); 
	 var url = 'user_availability1.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'email_address='+email_address; // greeting-name FILED KA NAAM
     var target = 'greeting1'; // JIS DIV ME RESULT SHOW KARWANA HAI
     //var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
	var myAjax = new Ajax.Updater(target, url, {

                method: 'get', parameters: pars,
                onComplete: function(){
						$('progressBar1').style.display = 'none';
					}

        }); 
}

////////// for registration step 3 validation /////////////
	function __checkVal(){
		x = 0;
		f = document.registration_step3;
		a = f.elements.length;
		for(i=0;  i < a; i++ ) {
			if(f.elements[i].name == "level_id[]") {
				if(f.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please Select at least one");
				return false;
			}
	}
	
	function __checkValSkill(){
		x = 0;
		f = document.crt_frecl_prfl;
		a = f.elements.length;
		for(i=0;  i < a; i++ ) {
			if(f.elements[i].name == "level_id[]") {
				if(f.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please Select at least one");
				return false;
			}
	}	
	
	function __gteLval(cname){
	//	alert(cname);
		s = "skill_id_"+cname;
	//	alert(s);
		c = "comment_"+cname;
		l = "level_id_"+cname;
		if(document.getElementById(l).checked) {
		
		//	alert("if");
			document.getElementById(s).className = 'validate-selection';
		//	document.getElementById(c).className = 'required';
		
		}else{

		//	alert("else");
			document.getElementById(s).className = '';
		//	document.getElementById(c).className = '';
			
			document.getElementById(c).value = '';
			
		}
		
		
		
	//	document.getElementById(s).className = 'validate-selection';
	//	document.getElementById(c).className = 'required';
		
	}
	
///////// registration step 4 ///////////	

	function __free(){
		//alert('hi');return false;
		// replace the button with a normal image tag
		//document.getElementById('free_registration').innerHTML = "<img src='images/bt_next.gif' alt='' />";
		window.location.href = "registration_save.php?action=registration_step_4&userType=0"
	}
	function __paid(){
		window.location.href = "registration_save.php?action=registration_step_4&userType=1"
	}
	
///////// create freelancer profile step 4 ///////////	

	function __freeFrPrfl(){
		window.location.href = "update_user_dtl.php?action=create_freelancer_step_next&userType=0"
	}
	function __paidFrPrfl(){
		window.location.href = "update_user_dtl.php?action=create_freelancer_step_next&userType=1"
	}	
	
///////// post job step 3 ////////
	function __checkValPostJob(){
		x = 0;
		a = document.post_job_step3.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.post_job_step3.elements[i].name == "skill_id[]") {
				if(document.post_job_step3.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please Select at least one Skill");
				return false;
			}
	}
	
	function __freePostJob(){
		window.location.href = "post_job_save.php?action=post_job_step_4&userType=0"
	}
	function __paidPostJob(){
		window.location.href = "post_job_save.php?action=post_job_step_4&userType=1"
	}	



function __checkBidValue(){
	
 var current_bid_value = document.getElementById('current_bid_value').value;
 var bid_value = document.getElementById('bid_value').value;
 var bidstatus = document.getElementById('bidstatus').value;
	//alert(current_bid_value+' '+bid_value);return false;

	if(bid_value == ''){
		alert('Please enter your bid value ');return false;	
	}
	if(isNaN(bid_value)){
	  //flg = validateNumber(formName,'bid_value',"Please enter valid amount value")
	  //if (!flg) return false
	  alert('Please enter valid amount value'); return false;
		
	}
	if(bid_value < current_bid_value){
		alert("You can't bid lower then "+bidstatus+" price");
		return false;
	}
}

function __checkOfferValue(bid_value,current_bid_value){
	
	if(bid_value < current_bid_value){
		alert("You can't offer lower then fixed value");
		document.getElementById('make_offer').value = '';
		return false;
	}
}
function __chekeAuctionItemPrices(theForm){
	
	var type =  document.getElementById('type').value;

	flg = validateBlank(theForm,'fixed_price','Please enter item price');
	if (!flg) return false;
	
	flg = validateNumber(theForm,'fixed_price',"Please enter valid amount value");
	if (!flg) return false;
	
		x = 0;
		a = document.createListStep2.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.createListStep2.elements[i].name == "payment_method[]") {
				if(document.createListStep2.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please select at least one payment method");
				return false;
			}
	
}

function __setPaymentDetailsClass(checkbox_id,field_id,sign_id){
   
	var ch = document.getElementById(checkbox_id).checked;
	/*if(ch == true){ 	//alert('checkbox id : '+checkbox_id+' field id : '+field_id+'  sign id :'+sign_id);
		document.getElementById(field_id).className = 'required search';	
		document.getElementById(sign_id).innerHTML = '*';
	}
	if(ch == false){
		alert('hi');
		document.getElementById(field_id).className = ' search';
		document.getElementById(sign_id).innerHTML = '';
	}*/
	
	if(ch == true){ 	//alert('checkbox id : '+checkbox_id+' field id : '+field_id+'  sign id :'+sign_id);
		document.getElementById(field_id).className = 'required efil2';	
		document.getElementById(sign_id).innerHTML = '*';
	}
	if(ch == false){
		//alert('hi');
		document.getElementById(field_id).className = ' efil2';
		document.getElementById(sign_id).innerHTML = '';
	}
	
	
}

function __validateOfferValue(theForm){
	flg = validateBlank(theForm,'make_offer','Please enter offer price')
	if (!flg) return false	
	flg = validateNumber(theForm,'make_offer',"Please enter valid amount value")
	if (!flg) return false
}
function ConfirmOfferAccepted(formaction,action){

		x = 0;
		a = document.offeraction.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.offeraction.elements[i].name == "offers[]") {
				if(document.offeraction.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			
			if(action == 'accepted'){
				var conf = window.confirm("Are you sure to accept this offer");	
				if(conf){
					document.getElementById('action').value = 'accepted';
					document.offeraction.action = formaction;
					document.offeraction.submit();
				}else{
					return false;	
				}
			}else if(action == 'rejected'){
				var conf = window.confirm("Are you sure to reject this offer");	
				if(conf){
					document.getElementById('action').value = 'rejected';
					document.offeraction.action = formaction;
					document.offeraction.submit();
				}else{
					return false;	
				}
			}
		}else {
				alert("Please select at least one offer");
				return false;
			}



}
function ConfirmBuynowRequestAccepted(formaction){

		x = 0;
		a = document.offeraction.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.offeraction.elements[i].name == "offers[]") {
				if(document.offeraction.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			var conf = window.confirm("Are you sure to accept this request");	
				if(conf){
					document.offeraction.action = formaction;
					document.offeraction.submit();
				}else{
					return false;	
				}
		}else {
				alert("Please select at least one request");
				return false;
			}
}

function __validatePaymentReply(formaction){
		x = 0;
		a = document.replyon_payment_send.elements.length;
		var payment_status;
		
		for(i=0;  i < a; i++ ) {
			if(document.replyon_payment_send.elements[i].name == "payment_status[]") {
				if(document.replyon_payment_send.elements[i].checked) {
					x++;
					payment_status = document.replyon_payment_send.elements[i].value;
				}
			}
		}
		if(x) {
				var conf = window.confirm("Are you sure to "+payment_status+" this payment details.");	
				if(conf){
					document.replyon_payment_send.action = formaction;
					document.replyon_payment_send.submit();
				}else{
					return false;	
				}
		}else {
				alert("Please select at least one payment status");
				return false;
			}
	
}
function delete_listing(formaction,id){
	var conf = window.confirm("Deleting this item will remove it from the website immediatelly. There is no undo for this. Are you sure you want to delete this item?");	
	if(conf){
		 var url = formaction+'/useritemlisting/true/action/delete/item_id/'+id;
	  	 document.location.href = url;
	}else{
		return false;	
	}
				
}


/* showing online status sign */
function CheckFreelancerIcon(user_id,divid){
	 var url = 'profileicon.php'; // JIS PHP FILE SE RESULT LENE HAI
     var pars = 'user_id='+user_id; // greeting-name FILED KA NAAM
     var target = 'freelancerProfile_onlinestatus'; // JIS DIV ME RESULT SHOW KARWANA HAI
	 var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 
}

function freelancer_profile(id){	
		CheckFreelancerIcon(id);
		setTimeout("freelancer_profile("+id+")",10000);
	}
	
function Profile_CheckOnlineStatus(id){
	setTimeout("freelancer_profile("+id+")",10000)
}

/*********************************************************/
// get the listing of featured freelancer list for right side box
function CheckFeaturedFreelancersIcon(){
	 var url = 'featured_freelancersList.php'; // JIS PHP FILE SE RESULT LENE HAI
	  var pars = ''; // greeting-name FILED KA NAAM
     var target = 'featured_freelancersList'; // JIS DIV ME RESULT SHOW KARWANA HAI
	// var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	 var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	// alert(myAjax);
}
function featured_freelancer_list(){	
		CheckFeaturedFreelancersIcon();
		setTimeout("featured_freelancer_list()",10000);
	}
	
function featuredFreelancers_CheckOnlineStatus(){
	setTimeout("featured_freelancer_list()",10000)
}

function ViewHideApplicants(divid,txt){
	
	var DivStyle = document.getElementById(divid).style.display;	

	if(DivStyle == 'none'){
		document.getElementById(divid).style.display = '';
		document.getElementById(txt).innerHTML = 'Hide  Applicants';
	}else{
		document.getElementById(divid).style.display = 'none';
		document.getElementById(txt).innerHTML = 'View  Applicants';
	}

}

function __validateApplicantsForm(formaction,id){
		x = 0;
		a = document.jobApplicants.elements.length;
		var payment_status;
		
		for(i=0;  i < a; i++ ) {
			if(document.jobApplicants.elements[i].name == "applicants[]") {
				if(document.jobApplicants.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
				//var conf = window.confirm("Are you sure to add this user in your team.");	
				var conf = window.confirm("Are you sure you want to add this user in your team?");	
				if(conf){
					document.jobApplicants.action = formaction;
					document.jobApplicants.submit();
				}else{
					return false;	
				}
		}else {
				alert("Please select at least one applicant.");
				return false;
			}
	
} 
function __validateApplicantsFormForPayment(formaction,id){
		x = 0;
		a = document.jobApplicants.elements.length;
		var payment_status;
		
		for(i=0;  i < a; i++ ) {
			if(document.jobApplicants.elements[i].name == "applicants[]") {
				if(document.jobApplicants.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
				var conf = window.confirm("Are you sure to make payment for this user.");	
				if(conf){
					document.jobApplicants.action = formaction;
					document.jobApplicants.submit();
				}else{
					return false;	
				}
		}else {
				alert("Please select at least one applicants.");
				return false;
			}
	
}
function __validateMakePaymentFormValue(theForm){

 	var payment_amount = document.getElementById('payment_amount').value;
	
	flg = validateBlank(theForm,'payment_amount','Please enter payment amount')
	if (!flg) return false	
	
	if(isNaN(payment_amount)){
		alert("Please enter valid payment amount.");	
		return false;
	}
	
}

function __paymentTransactionConfirm(pagelink,action){

//alert(pagelink); return false;

	var conf = window.confirm("Are you sure to "+action+" this transaction.")
	if(conf){
		document.location.href=pagelink;
	}else{
		return false;	
	}
}
/*function __withdrowPaymentMethod(showTab,hideTab1,hideTab2){
	document.getElementById(showTab).style.display = '';
	document.getElementById(hideTab1).style.display = 'none';
	document.getElementById(hideTab2).style.display = 'none';
}*/

function __withdrowPaymentMethod(showTab, allTabs){
	for(var index = 0; index<allTabs.length; index++){
		if(allTabs[index] != showTab) {
			document.getElementById(allTabs[index]).style.display = 'none';
		} else {
			document.getElementById(allTabs[index]).style.display = '';
		}
	}
}

function ShowHideDivDetails(divid,signid){
	
	var DivStyle = document.getElementById(divid).style.display;	

	if(DivStyle == 'none'){
		document.getElementById(divid).style.display = '';
		document.getElementById(signid).innerHTML = '[-]';
	}else{
		document.getElementById(divid).style.display = 'none';
		document.getElementById(signid).innerHTML = '[+]';
	}

}
function ShowHideDivDetails1(divid,signid){
	
	var DivStyle = document.getElementById(divid).style.display;	

	if(DivStyle == 'none'){
		document.getElementById(divid).style.display = '';
		document.getElementById(signid).innerHTML = 'Hide Comment';
	}else{
		document.getElementById(divid).style.display = 'none';
		document.getElementById(signid).innerHTML = 'Show Comment';
	}

}
function __ValidateMakePayment(formaction){
	
	//var conf = window.confirm("Are you sure to make payment for this user.");	
	var conf = window.confirm("Are you sure you want to make a payment for this user?");	
	if(conf){
		//alert(formaction); return false;
		document.location.href=formaction;
	}else{
		return false;	
	}	
}
function __ConfirmTeamMemberDismiss(formaction){
	
	var conf = window.confirm("Are you sure to dismiss this user from your team.");	
	if(conf){
		document.location.href=formaction;
	}else{
		return false;	
	}	
}

function __Rating_MouseOver(no){
	var val = parseInt(no);
	document.getElementById('setVal').value='false';
	for(i = 1; i <= val; i++){
		document.getElementById(i).src = 'images/star_up.jpg';
	}
	
}
function __Rating_MouseOut(){
var setval = document.getElementById('setVal').value;
	if(setval == 'false'){
			for(i = 1; i <=10; i++){
				document.getElementById(i).src = 'images/star_down.jpg';
			}
	  }
}
function __Rating_Set_Value(no){
	document.getElementById('feedback_rating').value = no;
	document.getElementById('setVal').value='true';
	var val = parseInt(no);
	for(i = val+1; i <= 10; i++){
		document.getElementById(i).src = 'images/star_down.jpg';
	}
}
function __checkforRating(){
	var setval = document.getElementById('setVal').value;
	var feedback_rating = document.getElementById('feedback_rating').value;
	if(setval == 'false'){
		alert('Please give rating.'); return false;
	}
}

function textCounter(field,cntfield,maxlimit,thefield) {
		cntfield.value = field.value.length;

		var num = eval(Math.ceil(cntfield.value/150));		
		
		if(cntfield.value>=maxlimit)
		{
			alert ("Sorry - there is a Max limit of "+maxlimit+" characters");
			field.value = field.value.substring(0,maxlimit-1)
			return false;
		}
		
		return true;
}
function Submit_MarketPlace_ImageUpload_Form(Formaction,n){
	
if(n == 1){	
	var imgname = document.getElementById('image_title').value;
	if(imgname == ''){
		alert('Please enter image title.');	return false;
	}
	var filename = document.getElementById('file').value;
	if(filename == ''){
		alert('Please upload image.');	return false;
	}
}
if(n == 2){	
	var imgname = document.getElementById('image_title').value;
	var filename = document.getElementById('file').value;
	if(imgname != ''){
		if(filename == ''){
			alert('Please upload image.');	
			return false;
		}
	}
	
	}
		document.createListStep3.action=Formaction;
		document.createListStep3.submit();
}

function disabledSubmitButton(id){
	//var email_address = ocument.getElementById('email_address').value;
	//alert(window.stus);
	//document.getElementById(id).innerHTML = '<span style=color:#FF0000><strong>Please Wait....<strong></span>';
}
function delayedRedirect(url){
	window.location = url;
}

function check_file_type(obj)
{
	var img_name = obj.value;
	var img_type = img_name.split(".");
	if(	img_type[img_type.length-1]!="jpeg" 
		&& img_type[img_type.length-1]!="jpg" 
		&& img_type[img_type.length-1]!="JPG" 
		&& img_type[img_type.length-1]!="png"
		&& img_type[img_type.length-1]!="gif"
		&& img_type[img_type.length-1]!=""
	  )
	{
		alert("Please upload only jpeg,jpg,gif & png extension files  !");
		return false
	}
}
function check_uploaded_file(formName,filetagid){
	var img_name = eval('document.'+formName+'.'+filetagid+'.value');
	var img_type = img_name.split(".");
	if(	img_type[img_type.length-1]!="jpeg" 
		&& img_type[img_type.length-1]!="jpg" 
		&& img_type[img_type.length-1]!="JPG" 
		&& img_type[img_type.length-1]!="png" 
		&& img_type[img_type.length-1]!="gif" 
		&& img_type[img_type.length-1]!="")
	{
		alert("Please upload only jpeg,jpg,gif & png extension files  !");
		return false
	}
}
function checkCVFile(formName,filetagid){  
	var img_name = eval('document.'+formName+'.'+filetagid+'.value');
	var img_type = img_name.split(".");
	//alert(img_type);return false;
	if(	img_type[img_type.length-1]!="doc" 
		&& img_type[img_type.length-1]!="docx" 
		&& img_type[img_type.length-1]!="txt" 
		&& img_type[img_type.length-1]!="pdf" 
		&& img_type[img_type.length-1]!="")
	{
		alert("Please upload only doc ,docx, txt and pdf extension files  !");
		return false
	}
	if(img_type == ''){
		alert("Please upload only doc ,docx, txt and pdf extension files  !");
		return false
	}
}
function check_uploaded_CVfile_type(obj)
{
	var img_name = obj.value;
	var img_type = img_name.split(".");
	if(	img_type[img_type.length-1]!="doc" 
		&& img_type[img_type.length-1]!="docx" 
		&& img_type[img_type.length-1]!="txt" 
		&& img_type[img_type.length-1]!="pdf" 
		&& img_type[img_type.length-1]!="")
	{
		alert("Please upload only doc ,docx, txt and pdf extension files  !");
		return false
	}
}
function showLocationBox(st){
	//alert(st);
	if(st == "inhouse"){	
		document.getElementById('location_box').style.display = '';
	}else{
		document.getElementById('location_box').style.display = 'none';
	}
}
function loginAlertForChat(url){
	if(window.confirm("Please login to chat.")){
		document.location.href=url;
	}else{
		return false;	
	}
	
}
function showFeatureProfilePrices(st){

//var checkVal =  document.getElementById(st).checked;
var divStyle =  document.getElementById('featured_profile_prices').style.display;

	if(divStyle == 'none'){	
		document.getElementById('featured_profile_prices').style.display = '';
	}else{
		document.getElementById('featured_profile_prices').style.display = 'none';
	}
}

function __chekePaymentMethod(theForm){
	
		x = 0;
		a = document.affiliate_registration_step3.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.affiliate_registration_step3.elements[i].name == "payment_method[]") {
				if(document.affiliate_registration_step3.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please select at least one payment method");
				return false;
			}
	
}



function addElement_siteurls() {
 // alert('hi');return false;
  var ni = document.getElementById('DivSiteUrls');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = num+'DivSiteUrls';
  newdiv.setAttribute('id',divIdName);
  //construct div
  var divtoadd = "";
	 	
		divtoadd +="<table width='100%' border='0' cellspacing='1' cellpadding='1'>";
		divtoadd +="<tr>";
		divtoadd +="<td width='60' align='left'>&nbsp;</td>";
		divtoadd +="<td width='185' align='left'>";
		divtoadd +="<table border='0' cellpadding='0' cellspacing='0'>";
		divtoadd +="<tr>";
		divtoadd +="<td width='4' height='21' style='background:#fff url(images/input_left.jpg) no-repeat;'></td>";
		divtoadd +="<td width='172' class='textbox1'><input name=siteurl_"+num+" id=siteurl_"+num+" type='text' value='' class='required validate-alpha search' title='Please Enter First Name'/></td>";
		divtoadd +="<td width='4' height='21' style='background:#fff url(images/input_right.jpg) no-repeat;'></td>";
		divtoadd +="</tr>";
		divtoadd +="</table></td>";
		divtoadd +="<td width='5' align='left'><span style='color:#FF0000'>*</span></td>";
		divtoadd +="<td  align='left'><a class=\"click\" href=\"javascript:;\" onclick=\"removeElementEmail(\'"+divIdName+"\')\">Remove</a></td>";
		divtoadd +="</tr>";
		divtoadd +="</table>";
 //alert(divtoadd);return false;
  newdiv.innerHTML = divtoadd;
  //alert(newdiv.innerHTML);
  ni.appendChild(newdiv);
}
function removeElementEmail(divNum) {
  if(confirm("Are you sure to remove this url."))
  {
	  var d = document.getElementById('DivSiteUrls');
	  var olddiv = document.getElementById(divNum);
	  d.removeChild(olddiv);
  }
}
function __pasteBannerCode(bannerCode){
	//alert(bannerCode);
	document.getElementById('bannerCode').value = bannerCode;
}
function check_portfolio_file_type(obj)
{

/* jpg, jpeg, gif, png, doc, docx, xls, xlsx, txt and pdf. */
	var img_name = obj.value;
	var img_type = img_name.split(".");
	if(	   img_type[img_type.length-1]!="jpeg"
		&& img_type[img_type.length-1]!="JPEG"
		&& img_type[img_type.length-1]!="jpg" 
		&& img_type[img_type.length-1]!="JPG" 
		&& img_type[img_type.length-1]!="png"
		&& img_type[img_type.length-1]!="PNG"
		&& img_type[img_type.length-1]!="gif"
		&& img_type[img_type.length-1]!="GIF"
		&& img_type[img_type.length-1]!="doc"
		&& img_type[img_type.length-1]!="DOC"
		&& img_type[img_type.length-1]!="docx"
		&& img_type[img_type.length-1]!="DOCS"
		&& img_type[img_type.length-1]!="xls"
		&& img_type[img_type.length-1]!="XLS"
		&& img_type[img_type.length-1]!="xlsx"
		&& img_type[img_type.length-1]!="XLSX"
		&& img_type[img_type.length-1]!="txt"
		&& img_type[img_type.length-1]!="TXT"
		&& img_type[img_type.length-1]!="pdf"
		&& img_type[img_type.length-1]!="PDF"
		&& img_type[img_type.length-1]!=""
	  )
	{
		alert("Please upload only jpg, jpeg, gif, png, doc, docx, xls, xlsx, txt and pdf extension files  !");
		return false
	}
}
function check_portfolio_uploaded_file(formName,filetagid){
	var img_name = eval('document.'+formName+'.'+filetagid+'.value');
	var img_type = img_name.split(".");
	if(	   img_type[img_type.length-1]!="jpeg"
		&& img_type[img_type.length-1]!="JPEG"
		&& img_type[img_type.length-1]!="jpg" 
		&& img_type[img_type.length-1]!="JPG" 
		&& img_type[img_type.length-1]!="png"
		&& img_type[img_type.length-1]!="PNG"
		&& img_type[img_type.length-1]!="gif"
		&& img_type[img_type.length-1]!="GIF"
		&& img_type[img_type.length-1]!="doc"
		&& img_type[img_type.length-1]!="DOC"
		&& img_type[img_type.length-1]!="docx"
		&& img_type[img_type.length-1]!="DOCS"
		&& img_type[img_type.length-1]!="xls"
		&& img_type[img_type.length-1]!="XLS"
		&& img_type[img_type.length-1]!="xlsx"
		&& img_type[img_type.length-1]!="XLSX"
		&& img_type[img_type.length-1]!="txt"
		&& img_type[img_type.length-1]!="TXT"
		&& img_type[img_type.length-1]!="pdf"
		&& img_type[img_type.length-1]!="PDF"
		&& img_type[img_type.length-1]!=""
	  )
	{
		alert("Please upload only jpg, jpeg, gif, png, doc, docx, xls, xlsx, txt and pdf extension files  !");
		return false
	}
}
function __chekePaymentMethods(theForm){
	
	flg = validateBlank(theForm,'fixed_price','Please enter item price');
	if (!flg) return false;
	
	flg = validateNumber(theForm,'fixed_price',"Please enter valid amount value");
	if (!flg) return false;
	
		x = 0;
		a = document.createListStep2.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.createListStep2.elements[i].name == "payment_method[]") {
				if(document.createListStep2.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please select at least one payment method");
				return false;
			}
	
}
function Submit_Edit_ItemListing_ImageUpload_Form(Formaction,n){
	
if(n == 1){	
	var imgname = document.getElementById('image_title').value;
	if(imgname == ''){
		alert('Please enter image title.');	return false;
	}
	var filename = document.getElementById('file').value;
	if(filename == ''){
		alert('Please upload image.');	return false;
	}
}
if(n == 2){	
	var imgname = document.getElementById('image_title').value;
	var filename = document.getElementById('file').value;
	if(imgname != ''){
		if(filename == ''){
			alert('Please upload image.');	
			return false;
		}
	}
	
	}
		document.createListStep3.action=Formaction;
		document.createListStep3.submit();
}

// Added by rakesh
function __setVal(url, params, target, paramVal){
     var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: params+paramVal});	 
}
 
 function apriPop(foto) { 
msg=open("","DisplayWindows"," toolbar=no,directories=no,menubar=no,resizable=yes,scrollbars=yes"); 
d=msg.document; 
d.write("<head><SCRIP"+"T>") 
d.write("function ridimensiona(){") 
d.write("window.resizeTo(") 
d.write("document.im1.width+100,") 
d.write("document.im1.height+120);") 
d.write("};document.title=document.im1.src;</SCRIP"+"T></head>") 
d.write("<body topmargin=5 leftmargin=5 scroll=yes>") 
d.write('<a href="#" onclick="window.close();">') 
d.write("<img src='"+foto+"' alt='Click to close the image' border='0' name='im1' onLoad='ridimensiona()'>") 
d.write("</a>") 
d.write("</body>") 
d.close() 
msg.focus() 
}
function showPROmembershipOffers(st){


	if(st == 'PRO')	{
		document.getElementById('pro_membership_offers').style.display = '';
	}else {
		document.getElementById('pro_membership_offers').style.display = 'none';
	 }
}

function validateFreeMemberContents(FormName,FieldName,UserType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType);
	
	if(UserType == 'free'){
			
			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
			//alert(StrObj);
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';return false;
			} */
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
		return true;
	}
}
function validateUserMessage(FormName,FieldName,UserType,ProjectType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType+'  ProjectType: '+ProjectType);
    
	if( UserType == 'free' && ProjectType == 'free' ) {

			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			//alert(StrObj);return false;
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);

			// CHEKCING FOR WEB SITE URL IN USER MESSAGE
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */

			// CHECKING FOR USER EMAIL ADDRESS IN MESSAGE
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
			return true;
	}
}
function validateNumber(formName,fieldName,msg){

var	doc = "document."

a=eval(doc+formName+"."+fieldName)
fieldValue=eval(doc+formName+"."+fieldName + ".value")

if (fieldValue.length<1)
{
	alert(msg)
	eval(doc+formName+"."+fieldName + ".select()")
	return false
}

chk1="1234567890";

	for(i=0;i!=fieldValue.length;i++)
	{
		ch1=fieldValue.charAt(i);
		rtn1=chk1.indexOf(ch1);
		if(rtn1==-1)
		{
			alert(msg);
			eval(doc+formName+"."+fieldName + ".focus()")
			return false;
			break;
		}
	}

return true	
}

function validateBudget(theForm){

var budgetVal = document.getElementById('project_budget_1').value;	
//alert(budgetVal);return false;
	if( budgetVal != ''){
		 flg = validateNumber(theForm,'project_budget_1',"This value can either be an integer or empty.")
		 if (!flg){
		 	document.getElementById('project_budget_1').value = '';	
		 	return false
		 }
	}
}
function validateBudgetOnHome(theForm){

var budgetVal = document.getElementById('quick_budget').value;	
//alert(budgetVal);return false;
	if( budgetVal != ''){
		 flg = validateNumber(theForm,'quick_budget',"Budget value can either be an integer or empty.")
		 if (!flg){
		 	document.getElementById('quick_budget').value = '';	
		 	return false
		 }
	}
}

function validatemessage(FormName,FieldName,UserType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType);
	
	if(UserType == 'free' || UserType == 'BASIC'  || UserType == ''){
			
			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
			//alert(StrObj);
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
		return true;
	}
}

function blockuser(name,pageurl){
	
	var conf = window.confirm('You are about to block this user. You will not receive any messages from this user anymore. Are you sure?');
	if(conf){
		location.href=pageurl;
	}else{
		return false;
	}
}

function unblockuser(name,pageurl){
	conf = window.confirm('You are about to unblock this user. Are you sure?');
	if(conf){
		location.href=pageurl;
	}else{
		return false;
	}
}
// Added by M.S.charan
function setMailStatus(pid,val,target){
    var url = 'SetMailStatus.php';
	var pars = 'pid='+pid+'&val='+val;
    var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});	 
}
function setPMStatus(pid,val,target){
    var url = 'SetPMStatus.php';
	var pars = 'pid='+pid+'&val='+val;
    var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});	 
}
function setPRObids(pid,val,target){
	var url = 'SetPRObids.php';
	var pars = 'pid='+pid+'&val='+val;
    var myAjax1 = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});	 
}


function validatePostjobDetailsForm(FormName,FieldName,UserType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType); return false;
/*  update on 01-06-2009	
	if(UserType == 'free' || UserType == 'BASIC'  || UserType == ''){
			
			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
			if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} 
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			//return true;
	}
	*/

	/* check for project skills */
	
	x = 0;
		a = document.post_job_step3.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.post_job_step3.elements[i].name == "skill_id[]") {
				if(document.post_job_step3.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please Select at least one Skill");
				return false;
		}
	
	
	
}

function validateEditjobDetailsForm(FormName,FieldName,UserType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType); return false;
	
	if(UserType == 'free' || UserType == 'BASIC' ){
			
			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			//return true;
	}

	/* check for project skills */
	
	x = 0;
		a = document.post_job_step3.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.post_job_step3.elements[i].name == "skill_id[]") {
				if(document.post_job_step3.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
			return true;
		}else {
				alert("Please Select at least one Skill");
				return false;
		}
}
function validateReplyApplicantMessage(FormName,FieldName,UserType,ProjectType){
	
	//alert('Form name: '+FormName+' Field name: '+FieldName+' UserType: '+UserType+'  ProjectType: '+ProjectType);
    
	if( (UserType == 'free' || UserType == 'BASIC') && ProjectType == 'free' ) {

			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			//alert(StrObj);return false;
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);

			// CHEKCING FOR WEB SITE URL IN USER MESSAGE
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */

			// CHECKING FOR USER EMAIL ADDRESS IN MESSAGE
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
			return true;
	}
}

function validateUserMessage2(FormName,FieldName,SenderUserType,ReceiverUserType){
	
/* chekcing the sender and receiver type if one of them is PRO them allow them to send thier email address in contents */
    
	if( (SenderUserType == 'free' || SenderUserType == 'BASIC') && (ReceiverUserType == 'free' || ReceiverUserType == 'BASIC') ) {

			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			//alert(StrObj);return false;
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);

			// CHEKCING FOR WEB SITE URL IN USER MESSAGE
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */

			// CHECKING FOR USER EMAIL ADDRESS IN MESSAGE
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
			return true;
	}
}
function validateUserMessage3(FormName,FieldName,ProjectType, EmployerType, AplicantUserType){
	
/* if project id is available in reocrd then i am checking for project type, employer type and applicant type 
   if all are BASIC then apply the JS validation rules
*/
 //   alert('Project type : '+ProjectType+'\nEmployer type : '+EmployerType+'\nApplicant type :'+AplicantUserType);
	if( (ProjectType == 'free' || ProjectType == 'BASIC') && (EmployerType == 'free' || EmployerType == 'BASIC')  &&  (AplicantUserType == 'free' || AplicantUserType == 'BASIC') ) {

			StrObj = eval('document.'+FormName+'.'+FieldName+'.value');
			//alert(StrObj);return false;
			var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);

			// CHEKCING FOR WEB SITE URL IN USER MESSAGE
			//if (StrObj.match(/\.mn$|\.co$|\.asis$|\.tv$|\.mobi$|\.ws$|\.cc$|\.in$|\.biz$|\.org$|\.web$|\.au$|\.info$|\.com$|\.net$|\.us$|\.co\.uk$/i)) {
			/*if (StrObj.match(/\.mn|\.co|\.asis|\.tv|\.mobi|\.ws|\.cc|\.in|\.biz|\.org|\.web|\.au|\.info|\.com|\.net|\.us|\.co\.uk/i)) {
				document.getElementById('validateMSG').style.display = '';
				return false;
			} */

			// CHECKING FOR USER EMAIL ADDRESS IN MESSAGE
			if(emailsArray){
				document.getElementById('validateMSG').style.display = '';
				return false;
			}
			document.getElementById('validateMSG').style.display = 'none';	
			return true;
	}else{
			return true;
	}
}
function showFullContestantMessage(shortmessid,fullmessid,morelink){
	
	var shor_mess = document.getElementById(shortmessid).style.display;
	var full_mess = document.getElementById(fullmessid).style.display;
	var more_link = document.getElementById(morelink).style.display;
	
	// FIRST MAKE THE SHORT MESSAGE HIDE
	
		
	
	if(full_mess == 'none'){
		//alert( 'show full message' );
		document.getElementById(shortmessid).style.display = 'none';
		document.getElementById(fullmessid).style.display = '';	
		document.getElementById(morelink).innerHTML = '[ - ]';
	}else{
		//alert( 'show short message' );
		document.getElementById(shortmessid).style.display = '';
		document.getElementById(fullmessid).style.display = 'none';
		document.getElementById(morelink).innerHTML = '[ + ]';
	}	
	
	
}

/* 23-06-2009 */
function setUserQuatationValue(userid,pid,target,did){
  	
/* get old budget and duration values */
	var oldquatationVal 	 = document.getElementById('old_budget').value;
	var oldquatationDuration = document.getElementById('old_duration').value;
	
/* get new budget and duration values */
	var newquatationVal 	 = document.getElementById('yournewbid').value;
	var newquatationDuration = document.getElementById('budgetDuration').value;

/* now check if old values are same as new then do not call AJAX functionality to update the DB record*/

if( ( oldquatationVal == newquatationVal ) &&  ( oldquatationDuration == newquatationDuration ) ){
	//alert('User do not make any change in his bid.');
	document.getElementById('wrongbudgetval').style.display = "none";
	currConvObj1.hideCurrConvDiv(did);
	return false;	
}

if(newquatationVal == ''){
	document.getElementById('yournewbid').value = '0';
	newquatationVal = '0';
	//alert('Busget value is null');	return false;
}

/* check for the budget value is a valid number  */

	 flg = checkvalidateNumber('updateUserQuatation','yournewbid',"Budget value can either be an integer or empty.")
		 if (!flg){
		 	document.getElementById('yournewbid').value = '';	
			document.getElementById('wrongbudgetval').style.display = "";
		 	return false
		 }


/* close the open div*/

currConvObj1.hideCurrConvDiv(did);

/* call the AJAX in background and update the DB */
	var url = 'SetUserQuatation.php';
	var pars = 'pid='+pid+'&uid='+userid+'&newbudgetval='+newquatationVal+'&newdurationval='+newquatationDuration;
    var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});	
	document.getElementById('userbudgetStr').innerHTML = newquatationVal+' '+newquatationDuration;
	document.getElementById(target).innerHTML = newquatationVal+' '+newquatationDuration;
	document.getElementById('wrongbudgetval').style.display = "none";

	document.getElementById('old_budget').value   = newquatationVal;
	document.getElementById('old_duration').value = newquatationDuration;
}

function checkvalidateNumber(formName,fieldName,msg){


var	doc = "document."

a=eval(doc+formName+"."+fieldName)
fieldValue=eval(doc+formName+"."+fieldName + ".value")

if (fieldValue.length<1)
{
	//alert(msg)
	eval(doc+formName+"."+fieldName + ".select()")
	return false
}

chk1="1234567890.";

	for(i=0;i!=fieldValue.length;i++)
	{
		ch1=fieldValue.charAt(i);
		rtn1=chk1.indexOf(ch1);
		if(rtn1==-1)
		{
			//alert(msg);
			eval(doc+formName+"."+fieldName + ".focus()")
			return false;
			break;
		}
	}

return true	
}
function check_video_uploaded_file(formName,filetagid){
	var img_name = eval('document.'+formName+'.'+filetagid+'.value');
	var img_type = img_name.split(".");
	if(	   img_type[img_type.length-1]!="mpeg"
		&& img_type[img_type.length-1]!="MPEG"
		&& img_type[img_type.length-1]!="mpg" 
		&& img_type[img_type.length-1]!="MPG" 
		&& img_type[img_type.length-1]!="avi"
		&& img_type[img_type.length-1]!="AVI"
		&& img_type[img_type.length-1]!="wmv"
		&& img_type[img_type.length-1]!="WMV"
		&& img_type[img_type.length-1]!="wav"
		&& img_type[img_type.length-1]!="WAV"
		&& img_type[img_type.length-1]!="mp3"
		&& img_type[img_type.length-1]!="MP3"
		&& img_type[img_type.length-1]!=""
	  )
	{
		alert("Please upload only mpeg, mpg, avi, wmv, wav and mp3 extension files  !");
		return false
	}
}
function trim(myString){
 
   return myString.replace( /^\s+/g,'').replace(/\s+$/g,'');
   
}
function setApplicantComment(appid,target,did){
  	
	var comment 	 =   document.getElementById('employerComment'+appid).value  ;
	var editaction   =   document.getElementById('editaction'+appid).value  ;
	var oldnote      =   document.getElementById('oldnote'+appid).value  ;
	var comment1 = comment.replace('/\n/','<br />');
	currConvObj2.hideCurrConvDiv(did);
	if(comment == oldnote){
		document.getElementById('AddCommentDIV_'+appid).style.display = 'none';
		document.getElementById('SubmitButtonID'+appid).style.display = 'none';
		return false;
	}
	if( trim(comment) =="" && editaction == 'false'){
			document.getElementById('AddCommentDIV_'+appid).style.display = 'none';
			document.getElementById('SubmitButtonID'+appid).style.display = 'none';
			return false;
	}
	
	
	/* call the AJAX in background and update the DB */
		var url = 'SetApplicantComment.php';
		var pars = 'appid='+appid+'&comment='+comment;
		var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});	
		
	if( trim(comment) =="" && editaction == 'true'){
			document.getElementById('ViewCommentDIV_'+appid).style.display = 'none';
			document.getElementById('AddCommentDIV_'+appid).style.display = '';
			document.getElementById('SubmitButtonID'+appid).style.display = '';
			document.getElementById('CommentIcon'+appid).src = 'images/2line_7icon.png';
			document.getElementById('CommentIcon'+appid).alt = 'Set the Note';
			document.getElementById('CommentIcon'+appid).title = 'Set the Note';
			return false;
	}		
		
		
		
	/* AFTER COMPLETING AJAX FUNCTIONALITY UPDATE THE PAGE FIELDS */	
		document.getElementById('CommentIcon'+appid).src = 'images/4line_7icon.png';
		document.getElementById('employerComment'+appid).value = '';
		document.getElementById('ViewCommentDIV_'+appid).style.display = '';
		document.getElementById('AddCommentDIV_'+appid).style.display = 'none';
		document.getElementById('EmployerCommentsdiv'+appid).innerHTML = "<img src='images/progress_bar.gif' alt='prograss bar'>";
		document.getElementById('SubmitButtonID'+appid).style.display = 'none';
		document.getElementById('oldnote'+appid).value   = comment;
		document.getElementById('CommentIcon'+appid).alt = 'View Note';
		document.getElementById('CommentIcon'+appid).title = 'View Note';
}

function openSubmitCommentDiv(appid){
	var oldnote      =   document.getElementById('oldnote'+appid).value  ;
	document.getElementById('editaction'+appid).value = 'true';	
	document.getElementById('employerComment'+appid).value = oldnote;
	document.getElementById('AddCommentDIV_'+appid).style.display = '';	
	document.getElementById('SubmitButtonID'+appid).style.display = '';
}


function forgetpass(){

	this.getElementsByClassName = function (oElm, strTagName, strClassName){
			var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
			var arrReturnElements = new Array();
			strClassName = strClassName.replace(/\-/g, "\\-");
			var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
			var oElement;
			for(var i=0; i<arrElements.length; i++){
				oElement = arrElements[i];
				if(oRegExp.test(oElement.className)){
					arrReturnElements.push(oElement);
				}
			}
			return (arrReturnElements)
		}

	this.hideAllCurrConvDiv = function () {
		objClassList = this.getElementsByClassName(document,'div','clsUsersCurrConv5');
		for(i=0;i<objClassList.length;i++) {
		  if(objClassList[i].id != undefined){
				objClassList[i].style.display = "none";
			}
		}
	}

	this.hideCurrConvDiv = function (element) {
		document.getElementById(element).style.display = "none";

		 document.getElementById('ForgotPasswordFormDiv').style.display = "";
		 document.getElementById('SuccessActionMsg').style.display = "none";
		 document.getElementById('msg_display').style.display = "none";
		 document.getElementById('forgot_email_address').value = '' 	
		 document.getElementById('username').value  = '';
	}

	this.showCurrConvDiv = function (element) {
		document.getElementById(element).style.display = "inline";
	}

	this.showConverter = function () {
		
		this.showCurrConvDiv('ForgetPass_Div');
		 document.getElementById('msg_display').style.display = "";
		 document.getElementById('msg_display').innerHTML = '';
		
	}
	

}
/*function forgetpasssubmitOLD(target){

	var emailid 	 =   document.getElementById('forgot_email_address').value  ;
	var username     =   document.getElementById('username').value  ;
	if(emailid != '' || username !=''){

		if(emailid != ''){
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (!filter.test(emailid)){
				document.getElementById('msg_display').innerHTML = 'Please enter valid email address.';
				document.getElementById('forgot_email_address').value = '' 	
				document.getElementById('username').value  = '';
				return false;
			}
		}

			document.getElementById('msg_display').innerHTML = "<img src='images/progress_bar.gif' alt='Processing.............'>";
			
			var url = 'forget-password-ajax.php';
			var pars = 'email_address='+emailid+'&username='+username;
			var myAjax = new Ajax.Updater('msg_display', url, {method: 'GET', parameters: pars});
		 			
		 document.getElementById('forgot_email_address').value = '' 	
		 document.getElementById('username').value  = '';
	
	}else{
		document.getElementById('msg_display').innerHTML = 'Please enter either email address or username.';
	}
	
}*/

function forgetpasssubmit(target){

	var emailid 	 =   document.getElementById('forgot_email_address').value  ;
	var username     =   document.getElementById('username').value  ;
	
	if(emailid != '' || username !=''){

		if(emailid != ''){
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (!filter.test(emailid)){
				document.getElementById('msg_display').innerHTML = 'Please enter valid email address.';
				document.getElementById('forgot_email_address').value = '' 	
				document.getElementById('username').value  = '';
				return false;
			}
		}

			document.getElementById('msg_display').innerHTML = "<img src='images/progress_bar.gif' alt='Processing.......'>";

			var pageUrl = 'forget-password-ajax.php';
			var params = 'email_address='+emailid+'&username='+username;
			 new Ajax.Request(  pageUrl,  { method: 'get', parameters: params, onFailure: ReportError,  
							  	onComplete: function(request) { 
																ProcessResults(request.responseText);
															   },  
										  evalScript: false
										  }  
			  				 );  
	}else{ 
		
		document.getElementById('msg_display').innerHTML = 'Please enter either email address or username.';
	}
	
}
function ProcessResults(responseText)  
 {  
  
	  switch(responseText)
	  {
		  case '1':
					document.getElementById('msg_display').innerHTML  = 'Email address does not exist...!';
					document.getElementById('forgot_email_address').value = '' 	
					document.getElementById('username').value  = '';
				  break;
		 case '2':
					document.getElementById('msg_display').innerHTML  = 'Username does not exist...!';
					document.getElementById('forgot_email_address').value = '' 	
					document.getElementById('username').value  = '';
					break;
		 case '3':
					document.getElementById('ForgotPasswordFormDiv').style.display = "none";
					document.getElementById('SuccessActionMsg').style.display = "";
					document.getElementById('msg_display1').innerHTML  = 'Please check your email and follow the instructions to reset your password.';
					document.getElementById('forgot_email_address').value = '' 	
					document.getElementById('username').value  = '';
					break;
		default:
					document.getElementById('msg_display').innerHTML  = 'Error occure accessing your account, please try later.';
					document.getElementById('forgot_email_address').value = '' 	
					document.getElementById('username').value  = '';
					break;
		  
	}
}  
   
 function ReportError(responseText)  
 {  
  alert(responseText);  
 }  
function showoptions(section){
	
var divStyle = document.getElementById('paywithpaypaldiv').style.display;

if(section == 'escrow')	{
		document.getElementById('paywithpaypaldiv').style.display = '';
	} else { 
		document.getElementById('paywithpaypaldiv').style.display = 'none';
	}
	
}
function emploginform(section){
	
var divStyle = document.getElementById('emploginformdiv').style.display;

	if(section == 'returninguser')	{
			document.getElementById('emploginformdiv').style.display = '';
			document.getElementById('empstatus1').value='returninguser';
	} else { 
		document.getElementById('emploginformdiv').style.display = 'none';
		document.getElementById('empstatus1').value='newuser';
	}
	
}
function __checkcompanyselection(){
		x = 0;
		a = document.listyourcompanyForm.elements.length;
		for(i=0;  i < a; i++ ) {
			if(document.listyourcompanyForm.elements[i].name == "companies[]") {
				if(document.listyourcompanyForm.elements[i].checked) {
					x++;
				}
			}
		}
		if(x) {
				if(x > 3) {
					alert("You can select maximum 3 caterogies.");return false;	
				}else{
					return true;	
				}
		}else {
				alert("Please Select at least one Category ");
				return false;
		}
	}


function __Rating_MouseOverCompanyReview(no){
	var val = parseInt(no);
	document.getElementById('setVal').value='false';
	for(i = 1; i <= val; i++){
		document.getElementById(i).src = 'images/star_up.jpg';
	}
	
}
function __Rating_MouseOutCompanyReview(){
var setval = document.getElementById('setVal').value;
	if(setval == 'false'){
			for(i = 1; i <=10; i++){
				document.getElementById(i).src = 'images/star_down.jpg';
			}
	  }
}
function __Rating_Set_ValueCompanyReview(no){
	document.getElementById('feedback_rating').value = no;
	document.getElementById('setVal').value='true';
	var val = parseInt(no);
	for(i = val+1; i <= 10; i++){
		document.getElementById(i).src = 'images/star_down.jpg';
	}
}
function __checkforRatingCompanyReview(){
	var setval = document.getElementById('setVal').value;
	var feedback_rating = document.getElementById('feedback_rating').value;
	if(setval == 'false'){
		alert('Please give rating.'); return false;
	}
}	
	
	
	
/*function setFormAction(formName,url){
	var form = 	eval('document.'+formName);
	form.action = url
}
function setFormAction1(formName,url,amount){
	if(amount <= 100){
		var form = 	eval('document.'+formName);
		form.action = url
	}
}
function showoptions(section){
//var DivStyle = document.getElementById(divid).style.display;		
alert(section);
var document.getElementById('paywithpaypaldiv').style.display;

if(section == 'escrow')	{
		document.getElementById('paywithpaypaldiv').style.display = '';
	} else { 
		document.getElementById('paywithpaypaldiv').style.display = 'none';
	}
	
}
*/