var closenow=1;

$(document).ready(function() {

			

		

		//admin tabs for household/Family

			

			$("#tab22").hide();

			$("#tab23").hide();	

			$("#tab2").hide();

			$("#tab3").hide();	

		//hiding drivers related fields

		$("#driverR1").hide();

		$("#driverR2").hide();	

		

		$("#row1").hide();	

		$("#row2").hide();	

		$("#row3").hide();	

		$("#row4").hide();	

		$("#row5").hide();	

		$("#row6").hide();

		$("#row17").hide();

		$("#row7").hide();

		$("#row8").hide();

		$("#row9").hide();

		$("#row10").hide();

		$("#row11").hide();

/*		$("#dq1").hide();

		$("#dq2").hide();

		$("#dq3").hide();*/

		//end

		//hiding childern related fields

		var amountchild=$("#amountChild").val();

		if(amountchild==0)

		{

			$("#childR1").hide();

			$("#childR2").hide();

			$("#childR3").hide();

			$("#childR4").hide();

			

		}

		

		$("#amountChild").change(function(){

		

			//alert("inside");

			if($("#amountChild").val()!=0)

			{

				$("#childR1").fadeIn("slow");

				$("#childR2").fadeIn("slow");

				$("#childR3").fadeIn("slow");

				$("#childR4").fadeIn("slow");

			}

			else

			{

				//alert("insideElse");

				$("#childR1").fadeOut("slow");

				$("#childR2").fadeOut("slow");

				$("#childR3").fadeOut("slow");

				$("#childR4").fadeOut("slow");

			}

		

		});

		//end

		

		//code added by abdul hameed dated 16122009

		//code for Global search on home page

		$("#gbsearch").click(function(){

		

			var ser = $("#searchterm12").val();

			//alert(ser);

			if(ser=='h')

			{

				var aupair = $('#aupair:checked').val();

				var cook = $('#cook:checked').val();

				var housekeeper = $('#housekeeper:checked').val();

				var chauffeur = $('#chauffeur:checked').val();

				var gardener = $('#gardener:checked').val();

				var nanny = $('#nanny:checked').val();

				var domesticcouple = $('#domestic-couple:checked').val();

				var country = $('#country').val();

				var sex1 = $('#gen1:checked').val();

				var sex2 = $('#gen2:checked').val();

				var photo1 = $('#Photo1:checked').val();

				var driver = $('#driver:checked').val();

				var livein = $('#livein:checked').val();

				var liveout = $('#liveout:checked').val();

				var nosmoker = $('#nosmoker:checked').val();

				var fulltime = $('#fulltime:checked').val();

				var parttime = $('#parttime:checked').val();

				

				var searchstr = '';

				if(aupair)

					searchstr="&aupair="+aupair;

				if(cook)	

					searchstr=searchstr+"&cook="+cook;

				if(housekeeper)

					searchstr=searchstr+"&housekeeper="+housekeeper;

				if(chauffeur)

					searchstr=searchstr+"&chauffeur="+chauffeur;

				if(gardener)

					searchstr=searchstr+"&gardener="+gardener;

				if(nanny)

					searchstr=searchstr+"&nanny="+nanny;

				if(domesticcouple)

					searchstr=searchstr+"&domesticcouple="+domesticcouple;

				if(country)

					searchstr=searchstr+"&country="+country;	

				if(sex1)

					searchstr=searchstr+"&sex1="+sex1;

				if(sex2)

					searchstr=searchstr+"&sex2="+sex2;

				if(photo1)

					searchstr=searchstr+"&photo1="+photo1;

				if(driver)

					searchstr=searchstr+"&driver="+driver;

				if(nosmoker)

					searchstr=searchstr+"&nosmoker="+nosmoker;	

				if(fulltime)

					searchstr=searchstr+"&fulltime="+fulltime;

				

				if(parttime)

					searchstr=searchstr+"&parttime="+parttime;

					

				if(livein)

					searchstr=searchstr+"&livein="+livein;

				

				if(liveout)

					searchstr=searchstr+"&liveout="+liveout;

			}

			else if(ser=='s')

			{

				searchstr='';

				var livein1 = $('#livein1:checked').val();

				var liveout1 = $('#liveout1:checked').val();

				var wd = $('#wdchild:checked').val();

				var wo = $('#wochild:checked').val();

				var city = $('#city:checked').val();

				var town = $('#town:checked').val();

				var rural = $('#rural:checked').val();

				var any1 = $('#any1:checked').val();

				var iama = $('#iama').val();

				var fulltime1 = $('#fulltime1:checked').val();

				var parttime1 = $('#parttime1:checked').val();

				

				if(livein1)

					searchstr=searchstr+"&livein1="+livein1;

				if(liveout1)

					searchstr=searchstr+"&liveout1="+liveout1;

				if(wd)

					searchstr=searchstr+"&wd="+wd;

				if(wo)

					searchstr=searchstr+"&wo="+wo;

				if(city)

					searchstr=searchstr+"&city="+city;	

				if(town)

					searchstr=searchstr+"&town="+town;	

				if(rural)

					searchstr=searchstr+"&rural="+rural;	

				if(any1)

					searchstr=searchstr+"&any="+any1;		

				if(iama)

					searchstr=searchstr+"&iama="+iama;	

				if(fulltime1)

					searchstr=searchstr+"&fulltime1="+fulltime1;	

				if(parttime1)

					searchstr=searchstr+"&parttime1="+parttime1;	

			}

			

							

				

			if(ser!='n')

				document.location="global_search.php?s="+ser+searchstr;

							

		  });

		

								  

										  

	$('#sex_female').click(function() {

		var mytitle=$('select[name="title"]').val();

		if (mytitle!="mrs" && mytitle!="miss" )

		{

			$('select[name="title"]').val('mrs');

			

		}	

	});

	$('#sex_male').click(function() {

		var mytitle=$('select[name="title"]').val();

		if (mytitle!="mr")

		{

			$('select[name="title"]').val('mr');

		

		}	

	});

	

	$('select[name="title"]').change(function() {

		var mytitle=$('select[name="title"]').val();

		var mysex=$('#sex_female').attr("checked");

		if (mytitle!="mr" && mysex!=true)

		{

			$('#sex_female').attr("checked","checked");

			$('#sex_male').parent().css({ "background-position" : "0px -16px" });

			$('#sex_female').parent().css({ "background-position" : "0px 5px" });

		}

		if (mytitle=="mr" && mysex==true)

		{

			$('#sex_male').attr("checked","checked");

			$('#sex_female').parent().css({ "background-position" : "0px -16px" });

			$('#sex_male').parent().css({ "background-position" : "0px 5px" });

		}

	});

	$('input[title!=""]').hint();

	// setup the tickboxes

	$(this).find(".frmCheckboxGroup").each(function(){

		$(this).children("li").addClass("frmCheckbox");

	});



	$("#mainContent").click(

		function(){

			//alert("closenow");

			if (closenow==0)

			closeAllMenus();

		}

	);

	$('#loginFormBoxCont ul li').hover(function() {

	  $(this).addClass('pretty-hover');

	  closenow=1;

	}, function() {

	  $(this).removeClass('pretty-hover');

	  closenow=0;

	});

	// setup the tickboxes



	

	$(".frmRadio").find(":input").each(function(){

		if($(this).attr("checked") != true) {

			$(this).parent().css({ "background-position" : "0px -16px" });

		}

		else	{

			$(this).parent().css({ "background-position" : "0px 5px" });

		}

	});

	

	$(".frmRadio").click(function(){

			//alert($(this).parent().attr("class"));

			$(this).parent().find(":input").each(function(){

				$(this).removeAttr("checked"); // remove all the checks

				//alert($(this).attr("name"));

				$(this).parent().css({ "background-position" : "0px -16px" }); // move all the bgs to unselected

			});

			

			$(this).css({ "background-position" : "0px 5px" });  // move the chosen bg

			$(this).children("input").attr({checked : "checked" }); // check the chosen radio

			

			var selectionNames = $(this).children("label").html();

			var dropdownTitle = $(this).parent().parent().children("div").children("span");



			dropdownTitle.html(selectionNames);					

			closeAllMenus();



	});

	

	$(".frmCheckbox").find(":input").each(function(){

		if($(this).attr("checked") != true) {

			$(this).parent().css({ "background-position" : "0px 5px" });

		}

		else	{

			$(this).parent().css({ "background-position" : "0px -16px" });

		}

	});

	

	$(".frmCheckbox").click(function(){	

		

		// check to see if select all has been clicked

		if($(this).children("input").hasClass("selectAll")) {

			if($(this).children("input").attr("checked")) {

				// we are removing the select all

				$(this).parent().find(":input").each(function(){

					$(this).parent().css({ "background-position" : "0px 5px" });

					$(this).removeAttr("checked");

				});

			} else {

				// we are ticking everything		

				$(this).parent().find(":input").each(function(){

						$(this).parent().css({ "background-position" : "0px -16px" });

						$(this).attr({checked : "checked" });

				});

			}

		} else {

			// switch the styles and tick/untick boxes as appropriate			

			if (location.href.indexOf('mailbox-') >= 0 ) return;

			

			if($(this).children("input").attr("checked")) {

				$(this).children("input").removeAttr("checked");

				$(this).css({ "background-position" : "0px 5px" });

			} else {

				$(this).children("input").attr({checked : "checked" });

				$(this).css({ "background-position" : "0px -16px" });

			}

		}

		

		// check select all status

		var selectionNames = "";

		var allSelected = true;

		



		$(this).parent().find(":input").each(function(){

			// loop through all the tick boxes and check if any are unticked

			// if they are unticked, then deselect the select all

			

			if(!$(this).attr("checked")) {

				if(!$(this).hasClass("selectAll")) { // skip select all

					allSelected = false;

				}

			} else {

				// add the selected tick box to the drop down title

				if(!$(this).hasClass("selectAll")) { // skip select all

					if(selectionNames != "") {

						selectionNames += ", " + $(this).parent().children("label").html();

					} else {

						selectionNames = $(this).parent().children("label").html();

					}

				}

			}

		});

						

		if(allSelected == true) {

			// tick select all

			$(this).parent().find(".selectAll").each(function(){

				$(this).attr({checked:"checked"});

				$(this).parent().css({ "background-position" : "0px -16px" });

			});

		} else {

			// dont tick select all

			$(this).parent().find(".selectAll").each(function(){

				$(this).removeAttr("checked");

				$(this).parent().css({ "background-position" : "0px 5px" });

			});

		}		



		// change the dropdown title to show all the selections (when mousing over it'll scroll through them all)

		var dropdownTitle = $(this).parent().parent().children("div").children("span");

		

		if(selectionNames != "") {

			$("#new_requiered").hide();

			dropdownTitle.html(selectionNames);

		} else {

			$("#new_requiered").show();

			dropdownTitle.html("<div style='color: red'>tick selection(s)</div>");

		}

	});

	

	$(".frmTickDropdown > div, .frmRadioDropdown > div").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().animate({ height: "30px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "159px" },{queue: false, duration: "fast"});



			$(this).parent().css({ "z-index": "9999" });

		}

	});



	$(".frmTickDropdown4 > div").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().animate({ height: "21px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "159px" },{queue: false, duration: "fast"});



			$(this).parent().css({ "z-index": "9999" });

		}

	});

	

	// animate title to loop through all the selections

	$(".frmTickDropdown > div > span").mouseover(function(){

		var theSpan = $(this);

		var spanHeight = theSpan.height();

		var spanPosition = theSpan.css("top");

		var newHeight = spanHeight;

		var totalMovements = newHeight/25;

		var theDuration = totalMovements * 500;

		if(spanPosition == "0px" && spanHeight > 30) {

			theSpan.animate({top:"-"+newHeight},{duration:"fast"});

			theSpan.animate({top:"20"},{duration:"fast"});

			theSpan.animate({top:"0px"},{duration:"fast"},null);

		}

	});

	$(".frmTickDropdown4 > div > span").mouseover(function(){

		var theSpan = $(this);

		var spanHeight = theSpan.height();

		var spanPosition = theSpan.css("top");

		var newHeight = spanHeight;

		var totalMovements = newHeight/25;

		var theDuration = totalMovements * 500;

		if(spanPosition == "0px" && spanHeight > 30) {

			theSpan.animate({top:"-"+newHeight},{duration:"fast"});

			theSpan.animate({top:"20"},{duration:"fast"});

			theSpan.animate({top:"0px"},{duration:"fast"},null);

		}

	});

	

	$(".frmTickDropdown > img").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().css({ height: "30px" });

			$(this).parent().css({ "z-index": "" });

		}

	});

	$(".frmTickDropdown4 > img").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().css({ height: "21px" });

			$(this).parent().css({ "z-index": "" });

		}

	});

	

	$(".frmInputDropdown > div > span > input").click(function() {

		if($(this).val() == "") {

			$(this).css({ color: "#999" });

			$(this).val("");

		}

	});

	

	$(".frmInputDropdown > div > span > input").blur(function() {

		if($(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("");

		}

	});

	

	

	$(".frmCurrencyDropdown > div").click(function(){

		if($(this).parent().css("height") == "100px") {

			$(this).parent().animate({ height: "25px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "100px" },{queue: false, duration: "fast"});

			$(this).parent().css({ "z-index": "9999" });

		}

	});

	

	$(".frmCurrencyDropdown label").click(function(){

		var parent = $(this).parent().parent().parent();

		$(".chosenCurrency").html($(this).html());

		parent.animate({ height: "25px" },{queue: false, duration: "fast"});

	});

	

	$(".frmCurrencyInput > input").click(function() {

		if($(this).attr("name") == "costFrom" && $(this).val() == "From this price" || $(this).attr("name") == "costTo" && $(this).val() == "Up to this price") {

			$(this).css({ color: "#999" });

			$(this).val("");

		}

	});

	

	$(".frmCurrencyInput > input").blur(function() {

		if($(this).attr("name") == "costFrom" && $(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("From this price");

		}

		if($(this).attr("name") == "costTo" && $(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("Up to this price");

		}

	});

	

	

	$(".frmRadioDropdown label").click(function(){

		var parent = $(this).parent().parent().parent();

		parent.animate({ height: "25px" },{queue: false, duration: "fast"});

	});

	

	$("#actionLeftScroller").mouseover(function(){

		$(this).animate({left: "-800px"},{queue: false, duration: "fast"} );

	});

	

	$("#actionLeftScroller").mouseout(function(){

		$(this).stop();

		$(this).animate({left: "0px"},{queue: false, duration: "fast"} );

	});

	

	

	$(".frmRadio").click(function() {

		$(".frmTickDropdown, .frmTickDropdown4").css({ height: "30px" });

	});

	

	

	$(".btnMainFamLooking").toggle(function() {

		$("#lookingSub").fadeIn("fast");

	}, function(){

		$("#lookingSub").fadeOut("fast");

	});



	$(".familyNav2 li a").click(function(){

		$("#lookingSub").hide();

	});



	$(".advancedTab").toggle(function(){

		$(".tableSearchAdvance").show();

	}, function(){

		$(".tableSearchAdvance").hide();

	});	

	

	/*

	date_min16 = new Date();

  if (datestartend=="") 

  {

  	year_min16 = date_min16.getFullYear()-15;

  	date_min16.setFullYear(year_min16);

  	datestartend='1900:' + year_min16;	

  }

  */

  

// $('#dateShow').attachDatepicker({dateFormat: 'dd/mm/yy', showOn: 'both', buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true,yearRange: datestartend, defaultDate: date_min16}); 



  today = new Date();

  max_year  = today.getFullYear() + 10;

$('#dateShow').datepicker({dateFormat: 'dd/mm/yy', showOn: 'both', yearRange: '1900:'+max_year, buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true}); 

$("#dateShow").blur(function(){ validator.element(this);});	

$('#dateShow1').datepicker({dateFormat: 'dd/mm/yy', showOn: 'both', yearRange: '1900:'+max_year, buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true});

$("#dateShow1").blur(function(){ validator.element(this);});

$('#dateShow3').datepicker({dateFormat: 'dd/mm/yy', showOn: 'both', yearRange: '1900:'+max_year, buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true});

$("#dateShow3").blur(function(){ validator.element(this);});	

});

function closeAllMenus() {

	$(".frmTickDropdown, .frmRadioDropdown, .frmCurrencyDropdown").css({ height: "30px" }); // close all other menus if they are open

	$(".frmTickDropdown3").css({ height: "20px" }); // close all other menus if they are open

	$(".frmTickDropdown4").css({ height: "21px" }); // close all other menus if they are open

	$(".frmTickDropdown, .frmRadioDropdown, .frmCurrencyDropdown").css({ "z-index": "" });

}



function setstart()

{



	// setup the tickboxes

	$(this).find(".frmCheckboxGroup").each(function(){

		$(this).children("li").addClass("frmCheckbox");

	});



	$("#mainContent").click(

		function(){

			//alert(closenow);

			if (closenow==0)

			closeAllMenus();

		}

	);

	$('#loginFormBoxCont ul li').hover(function() {

	  $(this).addClass('pretty-hover');

	  closenow=1;

	}, function() {

	  $(this).removeClass('pretty-hover');

	  closenow=0;

	});

	// setup the tickboxes



	

	$(".frmRadio").find(":input").each(function(){

		if($(this).attr("checked") != true) {

			$(this).parent().css({ "background-position" : "0px -16px" });

		}

		else	{

			$(this).parent().css({ "background-position" : "0px 5px" });

		}

	});

	

	$(".frmRadio").click(function(){

			//alert($(this).parent().attr("class"));

			$(this).parent().find(":input").each(function(){

				$(this).removeAttr("checked"); // remove all the checks

				//alert($(this).attr("name"));

				$(this).parent().css({ "background-position" : "0px -16px" }); // move all the bgs to unselected

			});

			

			$(this).css({ "background-position" : "0px 5px" });  // move the chosen bg

			$(this).children("input").attr({checked : "checked" }); // check the chosen radio

			

			var selectionNames = $(this).children("label").html();

			var dropdownTitle = $(this).parent().parent().children("div").children("span");



			dropdownTitle.html(selectionNames);

			//if(typeof(validator)=="object") validator.element($(this).children("input"));

			//if(typeof(validator1)=="object") validator1.element($(this).children("input"));

			//if(typeof(validator2)=="object") validator2.element($(this).children("input"));			

			//if(typeof(validator)=="object") validator.element(this);

			//if(typeof(validator1)=="object") validator1.element(this);

			//if(typeof(validator2)=="object") validator2.element(this);			

			

			closeAllMenus();



	});

	

	

	$(".frmCheckbox").find(":input").each(function(){		

		if($(this).attr("checked") != true) {

			$(this).parent().css({ "background-position" : "0px 5px" });

		}

		else	{

			$(this).parent().css({ "background-position" : "0px -16px" });

		}

	});

	

	$(".frmCheckbox").click(function(e){

		e.stopPropagation() //stop bubbling the event!

	

		// check to see if select all has been clicked

		if($(this).children("input").hasClass("selectAll")) {

			if($(this).children("input").attr("checked")) {

				// we are removing the select all

				$(this).parent().find(":input").each(function(){

					$(this).parent().css({ "background-position" : "0px 5px" });

					$(this).removeAttr("checked");

				});

			} else {

				// we are ticking everything		

				$(this).parent().find(":input").each(function(){

						$(this).parent().css({ "background-position" : "0px -16px" });

						$(this).attr({checked : "checked" });

				});

			}

		} else {

			// switch the styles and tick/untick boxes as appropriate			

			if($(this).children("input").attr("checked")) {

				$(this).children("input").removeAttr("checked");

				$(this).css({ "background-position" : "0px 5px" });

			} else {

				$(this).children("input").attr({checked : "checked" });

				$(this).css({ "background-position" : "0px -16px" });

			}

		}

		

		// check select all status

		var selectionNames = "";

		var allSelected = true;

		



		$(this).parent().find(":input").each(function(){

			// loop through all the tick boxes and check if any are unticked

			// if they are unticked, then deselect the select all

			

			if(!$(this).attr("checked")) {

				if(!$(this).hasClass("selectAll")) { // skip select all

					allSelected = false;

				}

			} else {

				// add the selected tick box to the drop down title

				if(!$(this).hasClass("selectAll")) { // skip select all

					if(selectionNames != "") {

						selectionNames += ", " + $(this).parent().children("label").html();

					} else {

						selectionNames = $(this).parent().children("label").html();

					}

				}

			}

		});

						

		if(allSelected == true) {

			// tick select all

			$(this).parent().find(".selectAll").each(function(){

				$(this).attr({checked:"checked"});

				$(this).parent().css({ "background-position" : "0px -16px" });

			});

		} else {

			// dont tick select all

			$(this).parent().find(".selectAll").each(function(){

				$(this).removeAttr("checked");

				$(this).parent().css({ "background-position" : "0px 5px" });

			});

		}		



		// change the dropdown title to show all the selections (when mousing over it'll scroll through them all)

		var dropdownTitle = $(this).parent().parent().children("div").children("span");

		if(selectionNames != "") {

			dropdownTitle.html(selectionNames);

		} else {

			dropdownTitle.html("<div style='color: red'>tick selection(s)</div>");

		}

		

		 

	});

	

	$(".frmTickDropdown > div, .frmRadioDropdown > div").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().animate({ height: "30px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "159px" },{queue: false, duration: "fast"});



			$(this).parent().css({ "z-index": "9999" });

		}

	});



	$(".frmTickDropdown4 > div").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().animate({ height: "21px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "159px" },{queue: false, duration: "fast"});



			$(this).parent().css({ "z-index": "9999" });

		}

	});

	

	// animate title to loop through all the selections

	$(".frmTickDropdown > div > span").mouseover(function(){

		var theSpan = $(this);

		var spanHeight = theSpan.height();

		var spanPosition = theSpan.css("top");

		var newHeight = spanHeight;

		var totalMovements = newHeight/25;

		var theDuration = totalMovements * 500;

		if(spanPosition == "0px" && spanHeight > 30) {

			theSpan.animate({top:"-"+newHeight},{duration:"fast"});

			theSpan.animate({top:"20"},{duration:"fast"});

			theSpan.animate({top:"0px"},{duration:"fast"},null);

		}

	});

	$(".frmTickDropdown4 > div > span").mouseover(function(){

		var theSpan = $(this);

		var spanHeight = theSpan.height();

		var spanPosition = theSpan.css("top");

		var newHeight = spanHeight;

		var totalMovements = newHeight/25;

		var theDuration = totalMovements * 500;

		if(spanPosition == "0px" && spanHeight > 30) {

			theSpan.animate({top:"-"+newHeight},{duration:"fast"});

			theSpan.animate({top:"20"},{duration:"fast"});

			theSpan.animate({top:"0px"},{duration:"fast"},null);

		}

	});

	

	$(".frmTickDropdown > img").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().css({ height: "30px" });

			$(this).parent().css({ "z-index": "" });

		}

	});

	$(".frmTickDropdown4 > img").click(function(){

		if($(this).parent().css("height") == "159px") {

			$(this).parent().css({ height: "21px" });

			$(this).parent().css({ "z-index": "" });

		}

	});

	

	$(".frmInputDropdown > div > span > input").click(function() {

		if($(this).val() == "") {

			$(this).css({ color: "#999" });

			$(this).val("");

		}

	});

	

	$(".frmInputDropdown > div > span > input").blur(function() {

		if($(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("");

		}

	});

	

	

	$(".frmCurrencyDropdown > div").click(function(){

		if($(this).parent().css("height") == "100px") {

			$(this).parent().animate({ height: "25px" },{queue: false, duration: "fast"});

		} else {

			closeAllMenus();

			$(this).parent().animate({ height: "100px" },{queue: false, duration: "fast"});

			$(this).parent().css({ "z-index": "9999" });

		}

	});

	

	$(".frmCurrencyDropdown label").click(function(){

		var parent = $(this).parent().parent().parent();

		$(".chosenCurrency").html($(this).html());

		parent.animate({ height: "25px" },{queue: false, duration: "fast"});

	});

	

	$(".frmCurrencyInput > input").click(function() {

		if($(this).attr("name") == "costFrom" && $(this).val() == "From this price" || $(this).attr("name") == "costTo" && $(this).val() == "Up to this price") {

			$(this).css({ color: "#999" });

			$(this).val("");

		}

	});

	

	$(".frmCurrencyInput > input").blur(function() {

		if($(this).attr("name") == "costFrom" && $(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("From this price");

		}

		if($(this).attr("name") == "costTo" && $(this).val() == "") {

			$(this).css({ color: "#939393" });

			$(this).val("Up to this price");

		}

	});

	

	

	$(".frmRadioDropdown label").click(function(){

		var parent = $(this).parent().parent().parent();

		parent.animate({ height: "25px" },{queue: false, duration: "fast"});

	});

	

	$("#actionLeftScroller").mouseover(function(){

		$(this).animate({left: "-800px"},{queue: false, duration: "fast"} );

	});

	

	$("#actionLeftScroller").mouseout(function(){

		$(this).stop();

		$(this).animate({left: "0px"},{queue: false, duration: "fast"} );

	});

	

	

	$(".frmRadio").click(function() {

		$(".frmTickDropdown, .frmTickDropdown4").css({ height: "30px" });

	});

	

	



	$(".familyNav2 li a").click(function(){

		$("#lookingSub").hide();

	});



	

  //if (datestartend=="") datestartend='1900:1990';	

  /*

  	

  if (datestartend=="") 

  {

  	year_min16 = date_min16.getFullYear()-15;

  	date_min16.setFullYear(year_min16);

  	datestartend='1900:' + year_min16;	

  }

  */

  

  today = new Date();

  max_year  = today.getFullYear() + 10;

  

 //$('#dateShow').attachDatepicker({dateFormat: 'dd/mm/yy', showOn: 'both', buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true,yearRange: datestartend, defaultDate: date_min16}); 

 $('#dateShow').datepicker({dateFormat: 'dd/mm/yy', showOn: 'both', yearRange: '1900:'+max_year, buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true}); 

 //$('#dateShow').attachDatepicker({dateFormat: 'dd/mm/yy', showOn: 'both', buttonImage: 'img/icons/icon-calendar.gif', buttonImageOnly: true,yearRange: datestartend}); 

$("#dateShow").blur(function(){ validator.element(this);});	

//$(".btnOptions").click(function() {});



}







function setallnone()

{

			$('#all').click( function() {

				$(".working").find(":input").each(function(){

					this.checked = "checked";

					if($(this).attr("checked") != true) {

						$(this).parent().css({ "background-position" : "0px 5px" });

					}

					else	{

						$(this).parent().css({ "background-position" : "0px -16px" });

					}

				});

	

			});

			$('#none').click( function() {

				$(".working").find(":input").each(function(){

					this.checked = "";

					if($(this).attr("checked") != true) {

						$(this).parent().css({ "background-position" : "0px 5px" });

					}

					else	{

						$(this).parent().css({ "background-position" : "0px -16px" });

					}

				});

	

			});

			$('#invert').click( function() {

				$(".working").find(":input").each(function(){

					this.checked = !this.checked;

					if($(this).attr("checked") != true) {

						$(this).parent().css({ "background-position" : "0px 5px" });

					}

					else	{

						$(this).parent().css({ "background-position" : "0px -16px" });

					}

				});

	

			});



}

var workingonoptionow;

function showhideme(a)

{

				//

				if (workingonoptionow!=a)

				{

					$(".optionListOuter").hide();

					workingonoptionow=a;

				}

				$(a).parent().children(".optionListOuter").toggle();		 

}





function countok(a)

{

	if($(a).attr("checked")==true)

		return 1;

	else

		return 0;

}

function countdays()

{

	return countok('#monday')+countok('#Friday')+countok('#Saturday')+countok('#Sunday')+countok('#Tuesday')+countok('#Thursday')+countok('#Wednesday');

}

function checkdays()

{

	var vx=document.form1.register.value;

	if (vx!="")

	{

		var vs=vx.substring(0,1);

		if (countdays()>vs)

			alert("You have ticked you will work "+vs+" days a week");

	}

	else

		alert("Select for how many days you want to work first.");

	

}



$(document).ready(function() {

	$('#monday').change(function(){ checkdays(); });

	$('#Friday').change(function(){ checkdays(); });

	$('#Saturday').change(function(){ checkdays(); });

	$('#Sunday').change(function(){ checkdays(); });

	$('#Thursday').change(function(){ checkdays(); });

	$('#Wednesday').change(function(){ checkdays(); });

	$('#Tuesday').change(function(){ checkdays(); });



});



function allok()

{

	var vx=document.form1.register.value;

	var vs=0;

	if (vx!="")

	{

		vs=vx.substring(0,1);

	}



	if (countdays()!=vs)

	{

		if (vs>0)

		{

			if (countdays()<vs)

				alert("You have not ticked "+vs+" days.Please select more days.");

			else

				alert("You have ticked more number of days then "+vs+".Please rectify the problem first.");

			document.form1.register.focus();

			return false;

		}

		else

		{

			alert("You have not selected how many days you would like to work");

			return false;

		}

		

	}

	return true;



}





/*** add Diego ***/



function last_action_save(id){

	

	var id_aux = "My_form_" + id;

	document.getElementById(id_aux).submit();



}



/**Advance search*/

function redirectAdvance()

{

		document.location="global_search.php?ad=1";

}



function hsDriver(v){

		

		if(v=='yes')

		{

			$("#dq1").fadeIn("slow");

			$("#dq2").fadeIn("slow");

			$("#dq3").fadeIn("slow");

			

		}

		else

		{

			$("#dq1").fadeOut("slow");

			$("#dq2").fadeOut("slow");

			$("#dq3").fadeOut("slow");

		}

}

