jQuery(document).ready(function(){
		
 	jQuery(".items div.scrolableItem").click(function(){
    	window.location=jQuery(this).find("a").attr("href");return false;
	});
		
/*	jQuery("#browsable").scrollable({hoverClass: 'hover', size:2, speed: 400}).circular().navigator(); 
	jQuery("#chained").scrollable({hoverClass: 'hover', size:3, speed: 1000}).circular().navigator().mousewheel().autoscroll({ 
    steps: 3, 
    interval: 1000         
}); */	
	
/*	jQuery("#browsables").scrollable({hoverClass: 'hover', size:4, speed: 400}).circular().navigator(); 
	jQuery("#chained").scrollable({hoverClass: 'hover', size:3, speed: 1000}).circular().navigator().mousewheel().autoscroll({ 
    steps: 3, 
    interval: 1000         
}); */	

/*	jQuery("#browsablea").scrollable({hoverClass: 'hover', size:2, speed: 400}).circular().navigator(); 
	jQuery("#chained").scrollable({hoverClass: 'hover', size:3, speed: 1000}).circular().navigator().mousewheel().autoscroll({ 
    steps: 3, 
    interval: 1000         
}); */
	
		
	//Caption Sliding (Partially Hidden to Visible)
	jQuery(".captionthumb").show();

	jQuery("div.resultsthumb", this).hover(function(){
	jQuery(this).find(".captionthumb").animate({top:'0px'},{queue:false,duration:160});
	}, function() {
	jQuery(this).find(".captionthumb").animate({top:'194px'},{queue:false,duration:160});
	});

	//Caption Sliding End (Partially Hidden to Visible)
	
	//Home Caption Sliding (Partially Hidden to Visible)
	jQuery(".palm").show();

	jQuery("div.inndiv", this).hover(function(){
										
	jQuery(this).find(".palm").animate({top:'140px'},{queue:false,duration:160});
	}, function() {
	jQuery(this).find(".palm").animate({top:'190px'},{queue:false,duration:160});
	});
	
	
	//Home Caption Sliding (Partially Hidden to Visible)
	jQuery(".title_palm").show();

	jQuery("div.inndiv2", this).hover(function(){
										
	jQuery(this).find(".title_palm").animate({top:'64px'},{queue:false,duration:160});
	}, function() {
	jQuery(this).find(".title_palm").animate({top:'110px'},{queue:false,duration:160});
	});
	


jQuery("span#name").click(function () {
	jQuery("#form").toggle("slow");
	jQuery("#agent_detail").toggle("slow");
	
      //jQuery("#agent_detail").slideDown("slow");
      //jQuery("#agent_detail").slideDown("slow");
    });

jQuery("#mhead").click(function () {

jQuery('#mhead').toggleClass('selected');

	
    });

/*jQuery("#mhead.head").click(function () {
									
	jQuery('#mhead').removeClass('head');
	jQuery('#mhead').addClass('selected');
	
    });*/
jQuery("#mhead").click(function () {
	/*jQuery("#msearch").slideDown("slow");
	jQuery('#mhead').removeClass('head');
	jQuery('#mhead').addClass('selected');*/
	jQuery("#msearch").slideToggle();
	jQuery("#refine").slideToggle();
	$("#theone").die("click", aClick)
	//jQuery("#refine").slideToggle();
    });

jQuery("h3.selected").click(function () {
									
/*	jQuery("#msearch").slideUp("slow");
*/	jQuery('#mhead').removeClass('selected');
	jQuery('#mhead').addClass('head');
	
    });

jQuery("h3.head").click(function () {
									
/*	jQuery("#msearch").slideUp("slow");
*/	jQuery('#mhead').removeClass('head');
	jQuery('#mhead').addClass('selected');
	
    });

/*jQuery(".up").click(function () {
								//alert("xxxxx");
	jQuery("#msearch").slideUp("slow");
	jQuery('#mhead').addClass('down');
	jQuery('#mhead').removeClass('up');
	
    });
*/

jQuery("h3#rsearch").click(function () {
	jQuery("#msearch").slideUp("slow");
    });

	jQuery("span#nameimg").click(function () {
	jQuery("#form").toggle("slow");
	jQuery("#agent_detail").toggle("slow");
	
      //jQuery("#agent_detail").slideDown("slow");
      //jQuery("#agent_detail").slideDown("slow");
    });

jQuery("span#send_enquiry").click(function () {

	  jQuery("#form").show("slow");
      jQuery("#agent_detail").slideUp("slow");
    });



jQuery("#currency_title").click(function () {

	  jQuery("#currency_drop").slideToggle("slow");

     
    });
	
	jQuery("#currency_drop").click(function () {

	  jQuery("#currency_drop").hide("slow");

     
    });


 /*jQuery("span#name").click(function () {
      if (jQuery("#agent_detail").is(":hidden")) {
		  
        jQuery("#agent_detail").slideDown("slow");
      }
    });


jQuery("#view_form").click(function () {
      if (jQuery("#form").is(":hidden")) {
		   jQuery("#form").show("slow");
		   jQuery("#agent_detail").slideUp();
       
      } else {
        jQuery("#form").hide();
      }
    });*/



	//Home Caption Sliding End (Partially Hidden to Visible)

	/*
	
	jQuery(document).ready(function() {
		jQuery('#Allcur').selectbox({debug: true});
	});	
	
	jQuery(document).ready(function() {
		jQuery('#AllCity').selectbox({debug: true});
		
	});
	
	jQuery(document).ready(function() {
		jQuery('#AllArea').selectbox({debug: true});
	});
	
	
	
	jQuery(document).ready(function() {
		jQuery('#Dubai').selectbox({debug: true});
	});
	jQuery(document).ready(function() {
		jQuery('#AbuDhabi').selectbox({debug: true});
	});
	jQuery(document).ready(function() {
		jQuery('#Ajman').selectbox({debug: true});
	});
	jQuery(document).ready(function() {
		jQuery('#Sharjah').selectbox({debug: true});
	});
	jQuery(document).ready(function() {
		jQuery('#Rasal-Khaimah').selectbox({debug: true});
	});
	
	jQuery(document).ready(function() {
		jQuery('#listingCategory').selectbox({debug: true});
	});
	
	
	jQuery(document).ready(function() {
		jQuery('#curr').selectbox({debug: true});
	});
	
	
	jQuery(document).ready(function() {
		jQuery('#bed').selectbox({debug: true});
	});*/

	
	jQuery("#contactLink").click(function(){
        if (jQuery("#contactForm").is(":hidden")){
			document.getElementById("isadvancesear").value=1;
			document.getElementById("cngclss").className="down";
			document.getElementById("droplist").innerHTML="Hide More Search Options";
			
			jQuery("#contactForm").slideDown("slow");
			
        }
        else{
            document.getElementById("isadvancesear").value=-1;
			document.getElementById("cngclss").className="";
			document.getElementById("droplist").innerHTML="Show More Search Options";
			
			jQuery("#contactForm").slideUp("slow");
        }
     });
	 
});

/*
 jQuery(document).ready(function(){ 
   jQuery("#AllCity").click(function(){ 
	 country_id=document.getElementById("AllCity").value;
	 alert(country_id);	 
     
	 //jQuery("#allareaforcity").load("users/change_city/"+country_id); 
   });
 });
*/

/*
 jQuery(document).ready(function(){
                jQuery("#hrdcontactLink").click(function(){
                    if (jQuery(”#hrdcontactForm”).is(”:hidden”)){
                        jQuery(”#hrdcontactForm”).slideDown(”slow”);
                    }
                    else{
                        jQuery(”#hrdcontactForm”).slideUp(”slow”);
                    }
                });
   });
   function closeForm(){
                jQuery(”#hrdmessageSent”).show(”slow”);
                setTimeout(’jQuery(”#hrdmessageSent”).hide();jQuery(”#hrdcontactForm”).slideUp(”slow”)’, 2000);
   }
*/
	
		
	jQuery(function() {
	jQuery(".items img").click(function() {
		// calclulate large image's URL based on the thumbnail URL (flickr specific)
		var url = jQuery(this).attr("src").replace("_p", "_b");
		
		// get handle to element that wraps the image and make it semitransparent
		var wrap = jQuery("#image_wrap").fadeTo("medium", 0.5);
	
		// the large image from flickr
		var img = new Image();
	
		// call this function after it's loaded
		img.onload = function() {
				
			// make wrapper fully visible
			wrap.fadeTo("fast", 1);
	
			// change the image
			wrap.find("img").attr("src", url);
			
		};
	
		// begin loading the image from flickr
		img.src = url;
	
	// when page loads simulate a "click" on the first image
	}).filter(":first").click();
	});

	
	
	
	/*function frmsubmit(thisfrm){
		alert(thisfrm);
		document.thisfrm.submit();

	}	
	function closeForm(){
				alert("hello");
                jQuery("#messageSent").show("slow");
                setTimeout('jQuery("#messageSent").hide();jQuery("#contactForm").slideUp("slow")', 2000);
    }*/
	
	function pro_tool(id1,id2)
	{
		//alert(id1);
		var tools=new Array("currency_conv","mot","area","contact");
		var tabs=new Array("tab1","tab2","tab3","tab4");
		
		 for (var i = 0; i < tools.length; i++)
		 { 
				if(tools[i]!=id1)
				{
					document.getElementById(tools[i]).style.display="none";
				}
		 }
		 
		 document.getElementById(id1).style.display="block";
		 
		 for (var j = 0; j < tabs.length; j++)
		 { 
				if(tabs[j]!=id2)
				{
					 document.getElementById(tabs[j]).className='';
				}
		 }
		 
		 document.getElementById(id2).className='active';

		 //alert("in function");
		
		}
		
	
	
	
	
	
	
	

		
	function init(tpath) 
	{
			
			//var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
			var fullUrl= window.location.href.slice(1,window.location.href.indexOf('?')).split('/');
			var methodName = fullUrl[fullUrl.length-1].toLowerCase();
			//alert("hello");
			//alert(window.location.href.slice(1,window.location.href.indexOf('?')).split('/').length);
			//hashes.length
			// <span id="sliderDiv2" style="width:250px; height:25px; float:left;" ></span>
			// - Slider  -----------------------------------------
			mySlider	       = new Bs_Slider();
			mySlider.attachOnChange(ajx_search);
			mySlider.width         = 225;
			mySlider.height        = 20;
			mySlider.imgDir   		= tpath+'img/';
			mySlider.setBackgroundImage('scrollpath.gif','no-repeat'); // scroll paht image
			mySlider.fieldName     = 'slider2_start';
			
			mySlider.minVal        = 0;
			mySlider.maxVal        = 50000000;
			
			mySlider.valueInterval = 2500000;//2941176.4705823459;//5000000; 
			mySlider.valueDefault  = 000000; //50; 2941176
			
			mySlider.setSliderIcon('scrollleft.gif', 10, 20); // slider left image
			mySlider.useInputField = 3;
			mySlider.styleValueFieldClass = 'sliderInput';
			mySlider.useSecondKnob        = true;
			mySlider.preventValueCrossing = true;
			mySlider.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.

			mySlider.fieldName2     = 'slider2_end';
			
			mySlider.minVal2        = 0;
			mySlider.maxVal2        = 50000000;
			
			mySlider.valueInterval2 = 2500000;//2941176.4705823459;//5000000;// (mySlider.maxVal2/10);//1000;
			mySlider.valueDefault2  = mySlider.maxVal2;//500;//400;
			mySlider.setSliderIcon2('scrollright.gif', 10, 20); //scroll slider right
			mySlider.useInputField2 = 3;
			mySlider.styleValueFieldClass2 = 'sliderInput';
			

		
			mySlider.drawInto('sliderDiv1');
			
			
			
			
			mySlider2	       = new Bs_Slider();
			mySlider2.attachOnChange(ajx_search);
			mySlider2.width         = 225;
			mySlider2.height        = 20;
			mySlider2.imgDir   		= tpath+'img/';
			mySlider2.setBackgroundImage('scrollpath.gif','no-repeat'); // scroll paht image
			mySlider2.fieldName     = 'slider3_start';
			
			mySlider2.minVal        = 0;
			mySlider2.maxVal        = 1000000;
			
			mySlider2.valueInterval = 50000;//2941176.4705823459;//5000000; 
			mySlider2.valueDefault  = 000000; //50; 2941176
			
			mySlider2.setSliderIcon('scrollleft.gif', 10, 20); // slider left image
			mySlider2.useInputField = 3;
			mySlider2.styleValueFieldClass = 'sliderInput';

			mySlider2.useSecondKnob        = true;
			mySlider2.preventValueCrossing = true;
			mySlider2.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.

			mySlider2.fieldName2     = 'slider3_end';
			
			mySlider2.minVal2        = 0;
			mySlider2.maxVal2        = 1000000;
			
			mySlider2.valueInterval2 = 50000;//2941176.4705823459;//5000000;// (mySlider.maxVal2/10);//1000;
			mySlider2.valueDefault2  = mySlider2.maxVal2;//500;//400;
			mySlider2.setSliderIcon2('scrollright.gif', 10, 20); //scroll slider right
			mySlider2.useInputField2 = 3;
			mySlider2.styleValueFieldClass2 = 'sliderInput';

		
			mySlider2.drawInto('sliderDiv2');
			
			
			
			
			mySlider2	       = new Bs_Slider();
			mySlider2.attachOnChange(ajx_search);
			mySlider2.width         = 225;
			mySlider2.height        = 20;
			mySlider2.imgDir   		= tpath+'img/';
			mySlider2.setBackgroundImage('scrollpath.gif','no-repeat'); // scroll paht image
			mySlider2.fieldName     = 'slider4_start';
			
			mySlider2.minVal        = 0;
			mySlider2.maxVal        = 8;
			
			mySlider2.valueInterval = 1;//2941176.4705823459;//5000000; 
			mySlider2.valueDefault  = 000000; //50; 2941176
			
			mySlider2.setSliderIcon('scrollleft.gif', 10, 20); // slider left image
			mySlider2.useInputField = 3;
			mySlider2.styleValueFieldClass = 'sliderInput';

			mySlider2.useSecondKnob        = true;
			mySlider2.preventValueCrossing = true;
			mySlider2.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.

			mySlider2.fieldName2     = 'slider4_end';
			
			mySlider2.minVal2        = 0;
			mySlider2.maxVal2        = 8;
			
			mySlider2.valueInterval2 = 1;//2941176.4705823459;//5000000;// (mySlider.maxVal2/10);//1000;
			mySlider2.valueDefault2  = mySlider2.maxVal2;//500;//400;
			mySlider2.setSliderIcon2('scrollright.gif', 10, 20); //scroll slider right
			mySlider2.useInputField2 = 3;
			mySlider2.styleValueFieldClass2 = 'sliderInput';

		
			mySlider2.drawInto('sliderDiv3');
			
			
			/*
			if(methodName=='search') 
			{
				mySlider2				= new Bs_Slider();
				mySlider2.width         = 225;
				mySlider2.height        = 20;
				mySlider2.imgDir   		= tpath+'img/';
				mySlider2.setBackgroundImage('scrollpath.gif','no-repeat'); // scroll paht image
				mySlider2.fieldName     = 'slider1_start';
				
				mySlider2.minVal        = 0;
				mySlider2.maxVal        = 10;
				
				mySlider2.valueInterval = 1;//2941176.4705823459;//5000000; 
				mySlider2.valueDefault  = 1; //50; 2941176
				
				mySlider2.setSliderIcon('scrollleft.gif', 10, 20); // slider left image
				mySlider2.useInputField = 3;
				mySlider2.styleValueFieldClass = 'sliderInput';

				mySlider2.useSecondKnob        = true;
				mySlider2.preventValueCrossing = true;
				mySlider2.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.

				mySlider2.fieldName2     = 'slider1_end';
				
				mySlider2.minVal2        = 0;
				mySlider2.maxVal2        = 10;
				
				mySlider2.valueInterval2 = 1;//2941176.4705823459;//5000000;// (mySlider.maxVal2/10);//1000;
				mySlider2.valueDefault2  = mySlider2.maxVal2;//500;//400;
				mySlider2.setSliderIcon2('scrollright.gif', 10, 20); //scroll slider right
				mySlider2.useInputField2 = 3;
				mySlider2.styleValueFieldClass2 = 'sliderInput';
				
				mySlider2.drawInto('sliderDiv2');
				
			}	*/	
			
	}
	
	
	
	
	
	function validateForm(frm)
	{
		var tempkeywordsearch = document.getElementById("simpsearch");
		
		if(tempkeywordsearch.value == "" || tempkeywordsearch.value == "Enter Keywords (City,Location, etc)")
		{
		$("#simpsearch").removeClass("fsuccess");
		$("#simpsearch").addClass("ferror");
		return false;
		}
		else
		{
		$("#simpsearch").removeClass("ferror");
		$("#simpsearch").addClass("fsuccess");
		}
		
		var btn=frm.searchType;
		var cnt = -1;
		var flag=true;
		for (var i=btn.length-1; i > -1; i--) {
			if (btn[i].checked) {cnt = i; i = -1;}
		}
		if (cnt > -1){
			flag=true;
		}else{ 
			alert('Please choose any search Type.'); 
			flag=false;
		}
		
		var simsearflag=document.getElementById("isadvancesear").value;
		var simseartxt=document.getElementById("simpsearch").value;
		var set=document.getElementById("set").value;
		
		
		var objRegExpInt  = /(^-?\d\d*$)/;
		var objRegExpStr = /^(\s*)$/;
		
		
		
		if(simseartxt!="" && simseartxt !="Enter Keywords (City,Location, etc)")
		{
			document.getElementById("isadvancesear").value=0;
			simsearflag == 0;
		
		}
		
		if(simsearflag == 0 && flag)
		{
			//alert(set);
			if(objRegExpStr.test(simseartxt)) 
			{
			
				simseartxt = simseartxt.replace(objRegExpStr, '');
				if( simseartxt.length == 0 || set == 0){
					alert('Please fill search criteria as in example.');
					flag=false;
					frm.simpsearch.focus();
				}else
					flag=true;
			}
			else if(simseartxt=='Enter Keywords (City,Location, etc)')
			{
				alert('Please fill search criteria as in example.');
					flag=false;
					frm.simpsearch.focus();
			
			}
		}
	 
		return flag;
	}
	
	
	
	function validateForm2(frm)
	{
		if (document.getElementById('email').value.search(/\S/)==-1) 
		{
		alert('Please enter your valid Email id.');
		document.getElementById('email').focus();
		return false;
		}
	
		var regEmail = /^([-a-zA-Z0-9._]+@[-a-zA-Z0-9.]+(\.[-a-zA-Z0-9]+)+)$/;
		if(!regEmail.test(document.getElementById('email').value))
		{
			alert("Invalid email address.");
			document.getElementById('email').value='';
			document.getElementById('email').focus();
			return false;
		}
		
		if(document.getElementById('found_by_other').checked)
		{
			if(document.getElementById('how_find_cmp_opt').value.search(/\S/)==-1) 
			{
			alert('Please enter your words.');
			document.getElementById('how_find_cmp_opt').focus();
			return false;
			}
		}
	}
	
	function makevolatile()
	{
		//alert(document.getElementById("simpsearch").value);
		document.getElementById("simpsearch").value="";
		document.getElementById("set").value="1";
	}
	
	function makevolatile3()
	{
		//alert(document.getElementById("simpsearch").value);
		document.getElementById("descriptionTestimon").value="";
	}
	
	function makevolatile4()
	{
		//alert(document.getElementById("simpsearch").value);
		document.getElementById("testimonUsers").value="";
	}
	
	function makevolatile2(id)
	{
		//alert(document.getElementById("simpsearch").value);
		document.getElementById(id).value="";
	}
	
	function showhide(id1,id2)
	{
		//alert(document.getElementById("simpsearch").value);
		document.getElementById(id1).style.display="none";
		document.getElementById(id2).style.display="block";
	}
	
	function validateCallbackForm(frm)
	{
		
		var btn=frm.searchType;
		var cnt = -1;
		var flag=true;
		for (var i=btn.length-1; i > -1; i--) {
			if (btn[i].checked) {cnt = i; i = -1;}
		}
		if (cnt > -1){
			flag=true;
		}else{ 
			alert('Please choose any search Type.'); 
			flag=false;
		}
		
		var simsearflag=document.getElementById("isadvancesear").value;
		var simseartxt=document.getElementById("simpsearch").value;
		
		var objRegExpInt  = /(^-?\d\d*$)/;
		var objRegExpStr = /^(\s*)$/;
			
		
		if(simsearflag == 0 && flag)
		{
			if(objRegExpStr.test(simseartxt)) 
			{
				simseartxt = simseartxt.replace(objRegExpStr, '');
				if( simseartxt.length == 0){
					alert('Please fill search criteria as in example.');
					flag=false;
					frm.simpsearch.focus();
				}else
					flag=true;
			}
		}
	 
		return flag;
	}
	


//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;
var popupActivity = 0;


//loading popup with jQuery magic!
function loadPopup1(){
	//loads popup only if it is disabled
	
	document.getElementById('iframe').innerHTML = "<div style=' margin:0 auto; display:block;' id='currency_conv'><iframe width='508' style='background:url(../img/currencybg.gif) repeat-x 0 100%;' scrolling=no frameborder=0 height='345' src='../tools/currency.html'>"+"</iframe>"+
"</div>"+
"<div style=' margin:0 auto; display:none' id='mot'>"+
"<iframe width='508' style='background:url(../img/currencybg.gif) repeat-x 0 100%;' scrolling=no frameborder=0 height='345' src='../tools/mtgcalculator.html'>"+"</iframe>"+
"</div>"+
"<div style=' margin:0 auto; display:none' id='area'>"+
"<iframe width='508' style='background:url(../img/currencybg.gif) repeat-x 0 100%;' scrolling=no frameborder=0 height='345' src='../tools/areacalculator.html'>"+"</iframe>"+
"</div>";

	window.scroll(0,0);
	if(popupStatus==0){
			$("#backgroundPopup").css({
				"opacity": "0.85"
			});
			jQuery("#backgroundPopup").fadeIn("slow");
			jQuery("#popupContact").fadeIn("slow");
			popupStatus = 1;
			popupActivity = 1;
	}	
}	



function loadPopup2(){	
	
	//loading popup with jQuery magic!
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.85"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact2").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 2;
	}	
}


function loadPopup3(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact3").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 3;
	}	
}


function loadPopup13(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact13").fadeIn("slow");
		popupStatus = 1;
		popupActivity =13;
	}	
}


function loadPopup14(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact14").fadeIn("slow");
		popupStatus = 1;
		popupActivity =14;
	}	
}


function loadPopup4(){	
	
	//loading popup with jQuery magic!
	
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact4").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 4;
	}	
}


function loadPopup5(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact5").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 5;
	}	
}

function loadPopup6(){	
	
	//loading popup with jQuery magic!
		
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact6").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 6;
	}	
}


function loadPopup7(){	
	
	//loading popup with jQuery magic!
		
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.85"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact7").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 7;
	}	
}

function loadPopup8(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);	
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact8").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 8;
	}	
}

function loadPopup9(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);	
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact9").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 9;
	}	
}

function loadPopup10(){	
	
	//loading popup with jQuery magic!
	window.scroll(0,0);	
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact10").fadeIn("slow");
		popupStatus = 1;
		popupActivity = 10;
	}	
}

function loadPopup11(){
	//loads popup only if it is disabled
	window.scroll(0,0);
	if(popupStatus==0){
			jQuery("#backgroundPopup").css({
				"opacity": "0.85"
			});
			jQuery("#backgroundPopup").fadeIn("slow");
			jQuery("#popupContact").fadeIn("slow");
			popupStatus = 1;
			popupActivity = 11;
			
			
	}	
	
}	

function loadPopup12(){
	//loads popup only if it is disabled
	window.scroll(0,0);
	if(popupStatus==0){
			jQuery("#backgroundPopup").css({
				"opacity": "0.85"
			});
			jQuery("#backgroundPopup").fadeIn("slow");
			jQuery("#popupContact").fadeIn("slow");
			popupStatus = 1;
			popupActivity = 12;
			
			
	}	
	
}	



//disabling popup with jQuery magic!
function disablePopup(){
	
	//disables popup only if it is enabled
	
	if(popupActivity==1)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	
	
	
	if(popupActivity==2)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact14").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==3)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact3").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==4)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact4").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==5)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact5").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	if(popupActivity==6)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact6").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==7)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact7").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==8)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact8").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==9)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact9").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==10)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact10").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==11)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	if(popupActivity==12)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact12").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	
	if(popupActivity==13)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact13").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
		if(popupActivity==14)
	{
		if(popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery("#popupContact14").fadeOut("slow");
			popupStatus = 0;
		}
		
	}
	
	
	popupActivity = 0;
}

//centering popup
function centerPopup1(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact").height();
	var popupWidth = jQuery("#popupContact").width();
	//centering
	
	jQuery("#popupContact").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});
	
	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}	

//centering popup
function centerPopup2(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact2").height();
	var popupWidth = jQuery("#popupContact2").width();
	//centering	
	
	jQuery("#popupContact2").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}	



//centering popup
function centerPopup3(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact3").height();
	var popupWidth = jQuery("#popupContact3").width();
	//centering			
	jQuery("#popupContact3").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});
	
	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
	
}


//centering popup
function centerPopup4(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact4").height();
	var popupWidth = jQuery("#popupContact4").width();
	//centering			
	jQuery("#popupContact4").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});
	
	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
	
}

//centering popup
function centerPopup5(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact5").height();
	var popupWidth = jQuery("#popupContact5").width();
	//alert(windowWidth);
	//alert(popupWidth);
	//centering	
		
	document.getElementById("propertyurl").value=document.getElementById("pagereference").value;	
	jQuery("#popupContact5").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});
	
	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
	
}


//centering popup
function centerPopup6(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact6").height();
	var popupWidth = jQuery("#popupContact6").width();
	//centering	
	
	jQuery("#popupContact6").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}	

//centering popup
function centerPopup7(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact7").height();
	var popupWidth = jQuery("#popupContact7").width();
	//centering	
	
	jQuery("#popupContact7").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}

//centering popup
function centerPopup8(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact8").height();
	var popupWidth = jQuery("#popupContact8").width();
	//centering	
	
	jQuery("#popupContact8").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}


//centering popup
function centerPopup9(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact9").height();
	var popupWidth = jQuery("#popupContact9").width();
	//centering	
	
	jQuery("#popupContact9").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}

//centering popup
function centerPopup10(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact10").height();
	var popupWidth = jQuery("#popupContact10").width();
	//centering	
	
	jQuery("#popupContact10").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}

function centerPopup11(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact11").height();
	var popupWidth = jQuery("#popupContact11").width();
	//centering	
	
	jQuery("#popupContact11").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}

function centerPopup12(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact").height();
	var popupWidth = jQuery("#popupContact").width();
	//centering	
	
	jQuery("#popupContact").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}



function centerPopup13(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact13").height();
	var popupWidth = jQuery("#popupContact13").width();
	//centering	
	
	jQuery("#popupContact13").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}

function centerPopup14(){
	
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact14").height();
	var popupWidth = jQuery("#popupContact14").width();
	//centering	
	
	jQuery("#popupContact14").css({
			"position": "absolute",
			/*"top": windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2*/
			"top": 100,
			"left": windowWidth/2-popupWidth/2
	});

	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}



//CONTROLLING EVENTS IN jQuery
jQuery(document).ready(function(){
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button1").click(function(){
		//centering with css
		centerPopup1();
		//load popup
		loadPopup1();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button2").click(function(){
		//centering with css
		centerPopup2();
		//load popup
		loadPopup2();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button3").click(function(){
		//centering with css
		centerPopup3();
		//load popup
		loadPopup3();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button4").click(function(){
		//centering with css
		centerPopup4();
		//load popup
		loadPopup4();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button5").click(function(){
		//centering with css
		centerPopup5();
		//load popup
		loadPopup5();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button6").click(function(){
		//centering with css
		centerPopup6();
		//load popup
		loadPopup6();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button7").click(function(){
		//centering with css
		centerPopup7();
		//load popup
		loadPopup7();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button8").click(function(){
		//centering with css
		centerPopup8();
		//load popup
		loadPopup8();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button9").click(function(){
		//centering with css
		centerPopup9();
		//load popup
		loadPopup9();
	});
	
	//LOADING POPUP
	//Click the button event!
	jQuery("#button10").click(function(){
		//centering with css
		centerPopup10();
		//load popup
		loadPopup10();
	});
	
	jQuery("#button11").click(function(){
		//centering with css
		centerPopup11();
		//load popup
		loadPopup11();
	});
	
	jQuery("#button12").click(function(){
		//centering with css
		centerPopup12();
		//load popup
		loadPopup12();
	});
	
	jQuery("#button13").click(function(){
		//centering with css
		centerPopup13();
		//load popup
		loadPopup13();
	});
	
		jQuery("#button14").click(function(){
		//centering with css
		centerPopup14();
		//load popup
		loadPopup14();
	});
	
	//CLOSING POPUP
	//Click the x event!
	
	jQuery("#popupContactClose1").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose2").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose3").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose4").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose5").click(function(){
		disablePopup();
	});
	jQuery("#popupContactClose6").click(function(){
		disablePopup();
	});
	jQuery("#popupContactClose7").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose8").click(function(){
		disablePopup();
	});
	jQuery("#popupContactClose9").click(function(){
		disablePopup();
	});
	jQuery("#popupContactClose10").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose11").click(function(){
		disablePopup();
	});
	
	jQuery("#popupContactClose13").click(function(){
		disablePopup();
	});
	
	
	jQuery("#popupContactClose14").click(function(){
		disablePopup();
	});
		
	//Click out event!
	jQuery("#backgroundPopup").click(function(){
		disablePopup();
	});
	
	
	//Press Escape event!
	jQuery(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

});	


//*--------- popup form at the detail page send mail to friend ----------*//
function callbackformemail()
{
	
	var myname=document.popcallbackemail.myname.value;
	var myemail=document.popcallbackemail.myemail.value;
	var frdname=document.popcallbackemail.frdname.value;
	var frdemail=document.popcallbackemail.frdemail.value;
		
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;		
	if(flag){
		if(objRegExpStr.test(myname)) 
		{
			callfname = myname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please fill My name.');
				flag=false;
				document.popcallbackemail.myname.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(!objRegExpEmail.test(myemail)) 
		{	
			alert('Please fill the My emailaddress.');
			flag=false;
			document.popcallbackemail.myemail.focus();
		}else
			flag=true;
	}
	
	if(flag)
	{
		if(objRegExpStr.test(frdname)) 
		{
			calllname = frdname.replace(objRegExpStr, '');
			if( calllname.length == 0){
				alert('Please fill Friend\' Name.');
				flag=false;
				document.popcallbackemail.frdname.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(!objRegExpEmail.test(frdemail)) 
		{	
			alert('Please fill the Valid Friend\' email address.');
			flag=false;
			document.popcallbackemail.frdemail.focus();
		}else
			flag=true;
	}
	
	//if(flag) disablePopup();
	
	return flag;
}


//*--------- popup form at the top of page call back ----------*//
function callbackform()
{
	
	//alert("xxx");
	var fullname=document.popcallback1.fullname.value;
	var phoneno=document.popcallback1.phoneno.value;
	var yourenquiry=document.popcallback1.yourenquiry.value;
	//alert(phoneno);
	//alert(phoneno);
	//alert(yourenquiry);
	
	var objRegExpStr = /^(\s*)$/;
	/*var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;*/
	var flag=true;		
	if(flag){
		
		if(objRegExpStr.test(fullname)) 
		{
			callfname = fullname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please fill the first name.');
				flag=false;
				document.popcallback1.fullname.focus();
			}else
				flag=true;
		}
		
	}
	
	if(flag)
	{
		if(objRegExpStr.test(phoneno)) 
		{
			calllname = phoneno.replace(objRegExpStr, '');
			if( calllname.length == 0){
				alert('Please fill the Phone Number.');
				flag=false;
				document.popcallback1.phoneno.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(objRegExpStr.test(yourenquiry)) 
		{
			calllname = yourenquiry.replace(objRegExpStr, '');
			if( calllname.length == 0){
				alert('Please fill the Enquiry.');
				flag=false;
				document.popcallback1.yourenquiry.focus();
			}else
				flag=true;
		}
		
	}
	
	//if(flag) disablePopup();
	
	return flag;
}



//*--------- popup form at the bottom of page news letter ----------*//
function callbackformnews(){  
	
	var fullname=document.popcallbacknews.fullname.value;
	var emailadd=document.popcallbacknews.emailadd.value;
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;	
	
	if(flag){
		if(objRegExpStr.test(fullname)) 
		{
			callfname = fullname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please fill Name.');
				flag=false;
				document.popcallbacknews.fullname.focus();
			}else
				flag=true;
		}
	}
		
	if(flag)
	{
		if(!objRegExpEmail.test(emailadd)) 
		{	
			alert('Please fill the Valid email address.');
			flag=false;
			document.popcallbacknews.emailadd.focus();
		}else
			flag=true;
	}
	
	
	
	return flag;

}



function make_offer(){  
	
	var fullname=document.popmake_offer.offer_name.value;
	var country=document.popmake_offer.country.value;
	var contact=document.popmake_offer.contact.value;
	var offer=document.popmake_offer.offer.value;
		
	//var emailadd=document.popcallbacknews.emailadd.value;
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;	
	
	// TOMS CUSTOMIZED
	var anum = /(^\d+$)|(^\d+\.\d+$)/ ;
	if (offer != '')
	{
		if (anum.test(offer))
		{
		var offerorigvalue = document.popmake_offer.offer_prop_orig_value.value;
		var minoffervalue = 0;
		var percoffervalue = offerorigvalue/100 ;
		percoffervalue = percoffervalue*20;
		minoffervalue = offerorigvalue - percoffervalue;
		}
		else
		{
		flag = false;
		alert('Please provide offer only in numbers without any comma and space');
		}
	}
	// END TOMS CUSTOMIZED
	
	if(flag){
		if(objRegExpStr.test(fullname)) 
		{
			callfname = fullname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Enter Your Name.');
				flag=false;
				document.popmake_offer.offer_name.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(country)) 
		{
			callfname = country.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Select Country.');
				flag=false;
				document.popmake_offer.country.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(contact)) 
		{
			callfname = contact.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Enter Contact Number.');
				flag=false;
				document.popmake_offer.contact.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(offer)) 
		{
			callfname = offer.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Enter Your Offer.');
				flag=false;
				document.popmake_offer.offer.focus();
			}else
				flag=true;
		}
	}
		
	/*if(flag)
	{
		if(!objRegExpEmail.test(emailadd)) 
		{	
			alert('Please fill the Valid email address.');
			flag=false;
			document.popcallbacknews.emailadd.focus();
		}else
			flag=true;
	}*/
	
	// TOMS CUSTOMIZED
	if(flag)
	{
		if(offer < minoffervalue)
		{
		alert('We accept offers only 20% below asking price');
		flag = false;
		}
		else
		flag = true;
	
	}
	// END TOMS CUSTOMIZED
	
	
	return flag;

}

	function set_value(value,div1,div2,div3)
	{
		//alert(div2);
		if(value!=-1)
		{
		
		 document.getElementById(div3).innerHTML=value;
		}
		document.getElementById(div1).value=value;
		 document.getElementById(div2).style.display="none";
		
	
	
	
	}
	
	function hide_div(div_id)
	{
		//alert(div2);
		
		 document.getElementById(div_id).style.display="none";
		
	
	
	
	}
	function show_div(div_id)
	{
		//alert(div2);
		var text_val=document.getElementById('simpsearch').value;
		//alert(text_val);
		if(text_val=="" || text_val=="Enter Keywords (City,Location, etc)")
		{
		 document.getElementById(div_id).style.display="block";
		}
		
	
	
	
	}

function agentcallbackform(){


	var fullname=document.agentsendamailfrm.fullname.value;
	var emailadd=document.agentsendamailfrm.emailadd.value;
	var phoneno=document.agentsendamailfrm.phoneno.value;
	var yourenquiry=document.agentsendamailfrm.yourenquiry.value;
		
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;		
	if(flag){
		if(objRegExpStr.test(fullname)) 
		{
			callfname = fullname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Name.');
				flag=false;
				document.agentsendamailfrm.fullname.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(!objRegExpEmail.test(emailadd)) 
		{	
			alert('Please Email Address.');
			flag=false;
			document.agentsendamailfrm.emailadd.focus();
		}else
			flag=true;
	}
	
	if(flag)
	{
		if(objRegExpStr.test(phoneno)) 
		{
			calllname = phoneno.replace(objRegExpStr, '');
			if( calllname.length == 0){
				alert('Please fill Friend\' Name.');
				flag=false;
				document.agentsendamailfrm.phoneno.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(objRegExpStr.test(yourenquiry)) 
		{
			calllname = yourenquiry.replace(objRegExpStr, '');
			if( calllname.length == 0){
				alert('Please Fill Enquery.');
				flag=false;
				document.agentsendamailfrm.yourenquiry.focus();
			}else
				flag=true;
		}
	}
	
	
	//if(flag) disablePopup();
	
	return flag;

}

		

function listwithusvalidate(){


	var title=document.listwithus.title.value;
	var fname=document.listwithus.fname.value;
	var lname=document.listwithus.lname.value;
	var mobilephone=document.listwithus.mobilephone.value;
	var emailadd=document.listwithus.emailadd.value;
	
		
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;		
	if(flag){
		if(objRegExpStr.test(title)) 
		{
			callfname = title.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Title.');
				flag=false;
				document.listwithus.title.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(fname)) 
		{
			callfname = fname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill First Name.');
				flag=false;
				document.listwithus.fname.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(lname)) 
		{
			callfname = lname.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Last Name.');
				flag=false;
				document.listwithus.lname.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(mobilephone)) 
		{
			callfname = mobilephone.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Mobile Number.');
				flag=false;
				document.listwithus.mobilephone.focus();
			}else
				flag=true;
		}
	}
	
	if(flag)
	{
		if(!objRegExpEmail.test(emailadd)) 
		{	
			alert('Please Valid Email Address.');
			flag=false;
			document.listwithus.emailadd.focus();
		}else
			flag=true;
	}
	
	
	//if(flag) disablePopup();
	
	return flag;

}

function contactusvalidate(){


	//alert("xxxxxxxxxxxxxxxxxxx");

	var fname=document.listwithus.fname.value;
	//alert(fname);
	//var mobilephone=document.listwithus.mobilephone.value;
	var emailadd=document.listwithus.email.value;
	//var mobile=document.listwithus.company.value;
	
	//alert(company);	
	
	var objRegExpStr = /^(\s*)$/;
	var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;		
	
	
	if(flag){
		
		/*if(objRegExpStr.test(fname)) 
		{*/
			
			callfname = fname.replace(objRegExpStr, '');
		
			if( callfname.length == 0 || fname=="Enter First Name"){
				alert('Please Fill First Name.');
				flag=false;
				document.listwithus.fname.focus();
			}else
				flag=true;
		//}
	}
	
	
	/*if(flag){
		if(objRegExpStr.test(company)) 
		{
			callfname = company.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Company Name.');
				flag=false;
				document.listwithus.company.focus();
			}else
				flag=true;
		}
	}*/
	
	
	if(flag)
	{
		if(!objRegExpEmail.test(emailadd)) 
		{	
			alert('Please Valid Email Address.');
			flag=false;
			document.listwithus.email.focus();
		}else
			flag=true;
	}
	
	
	//if(flag) disablePopup();
	
	return flag;

}




function setarea(areaname){
	document.getElementById('divareaname').value=areaname;
}

function TestFileType( fileTypes ) {
		var fileName = document.getElementById('phototestid').value;
		//alert(fileName);
		//if (!fileName) return false;

		dots = fileName.split(".")
		//get the part AFTER the LAST period.
		fileType = "." + dots[dots.length-1];
		//alert(fileType);
		if(fileTypes.join(".").indexOf(fileType) != -1) {
			if(checkTestMonOthers()){
			return true;
			}else{
			return false;
			}
		}else{
		alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again.");
		return false;
		}

}

function checkTestMonOthers()
{

	var descriptionTestimon = document.getElementById('descriptionTestimon').value;
	var testimonUsers = document.getElementById('testimonUsers').value;
	
	var objRegExpStr = /^(\s*)$/;
	//var objRegExpEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var flag=true;		
	if(flag){
		if(objRegExpStr.test(descriptionTestimon)) 
		{
			callfname = descriptionTestimon.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Description.');
				flag=false;
				//document.listwithus.title.focus();
			}else
				flag=true;
		}
	}
	
	if(flag){
		if(objRegExpStr.test(testimonUsers)) 
		{
			callfname = testimonUsers.replace(objRegExpStr, '');
			if( callfname.length == 0){
				alert('Please Fill Name.');
				flag=false;
				//document.listwithus.title.focus();
			}else
				flag=true;
		}
	}
	
	return flag;

}

function map_page()
{	
	//load_map();
	window.location="/allsopp/users/search?galleryview=2";
	load_map();
	//alert("loadmap");
}


function changeCurrency(curr,type)
{
	
/*	alert(curr);
	alert(type);
	var curr_value=document.getElementById("currency").value;
	//alert(curr_value);
	var arr_value=curr_value.split(",");
	var cur_price=arr_value[0];
	var cur_type=arr_value[1];*/
	var cur_string=curr+"&nbsp;</label><span>"+type+"</span>";
	//alert(cur_string);
	
	document.getElementById('rateamt').innerHTML=cur_string;
}

function slider_showhide(show,hide)
{
	//alert(show);
	document.getElementById(hide).style.display="none";
	document.getElementById(show).style.display="block";
}

function change_price()
{
	//alert(show);
	var prop=document.getElementById('prop_type').value;
	if(prop=='RENT'){
	
		document.getElementById('range_from').innerHTML="<select name=\"amountmin\"><option value=\"\">From Price</option><option value=\"100000\">100,000</option><option value=\"200000\">200,000</option><option value=\"300000\">300,000</option><option value=\"400000\">400,000</option><option value=\"500000\">500,000</option><option value=\"600000\">600,000</option><option value=\"700000\">700,000</option><option value=\"800000\">800,000</option><option value=\"900000\">900,000</option><option value=\"1000000\">1,000,000</option></select>";
		document.getElementById('range_to').innerHTML="<select name=\"amountmin\"><option value=\"\">To Price</option><option value=\"100000\">100,000</option><option value=\"200000\">200,000</option><option value=\"300000\">300,000</option><option value=\"400000\">400,000</option><option value=\"500000\">500,000</option><option value=\"600000\">600,000</option><option value=\"700000\">700,000</option><option value=\"800000\">800,000</option><option value=\"900000\">900,000</option><option value=\"1000000\">1,000,000</option></select>";
		
}
else {

document.getElementById('range_from').innerHTML="<select name=\"amountmin\"><option value=\"\">From Price</option><option value=\"100000\">100,000</option><option value=\"200000\">200,000</option><option value=\"300000\">300,000</option><option value=\"400000\">400,000</option><option value=\"500000\">500,000</option><option value=\"600000\">600,000</option><option value=\"700000\">700,000</option><option value=\"800000\">800,000</option><option value=\"900000\">900,000</option><option value=\"1000000\">1,000,000</option><option value=\"2000000\">2000,000</option><option value=\"3000000\">3000,000</option><option value=\"4000000\">4000,000</option><option value=\"5000000\">5,000,000</option></select>";
		document.getElementById('range_to').innerHTML="<select name=\"amountmin\"><option value=\"\">To Price</option><option value=\"100000\">100,000</option><option value=\"200000\">200,000</option><option value=\"300000\">300,000</option><option value=\"400000\">400,000</option><option value=\"500000\">500,000</option><option value=\"600000\">600,000</option><option value=\"700000\">700,000</option><option value=\"800000\">800,000</option><option value=\"900000\">900,000</option><option value=\"1000000\">1,000,000</option><option value=\"2000000\">2000,000</option><option value=\"3000000\">3000,000</option><option value=\"4000000\">4000,000</option><option value=\"5000000\">5,000,000</option></select>";
	
	}
	
	
}

