window.addEvent('domready', function() {	
	var myMenu1 = new PillMenu('menu1', {
		duration: 'short',
		transition: Fx.Transitions.Quart.easeOut
	});	
		

	document.getElementById('rent_price').style.display = 'none';
	document.getElementById('sale_price').style.display = 'none';
	//our event function
	var handler = function() {
		if(select.value==1) {
			document.getElementById('rent_price').style.display = 'block';
			document.getElementById('sale_price').style.display = 'none';
		}else if(select.value==2) {
			document.getElementById('rent_price').style.display = 'none';	
			document.getElementById('sale_price').style.display = 'block';		
		}else{
			document.getElementById('rent_price').style.display = 'none';
			document.getElementById('sale_price').style.display = 'none';			
		}
	};
	var select = document.getElementById('lors');
	if(select.addEventListener){
		select.addEventListener('change',handler,false);
	}
	else {
		select.attachEvent('onchange',handler,false);
	}

	 

  	  	$$('.mix_btn').each(function(img) {
									 
									 
	img.addEvent('mouseover', function() { 
	this.set('opacity','0.5'); 
	});
	img.addEvent('mouseout', function() { 
	this.set('opacity','1'); 
	});
	/*
	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.d_red');
	//this.toggle();
	});
	*/
  });
		  
$$('.chval_box').each(function(img) {
			
	img.addEvent('click', function() { 
	if(img.checked==true){
	 $('exf_blank_all').value=parseInt( $('exf_blank_all').value)+1; 
	}else{
	 $('exf_blank_all').value=parseInt( $('exf_blank_all').value)-1; 
		
		}
	});
});
  	  	$$('.round_btn').each(function(img) {
									 
									 
	img.addEvent('mouseover', function() { 
	this.set('opacity','0.5'); 
	});
	img.addEvent('mouseout', function() { 
	this.set('opacity','1'); 
	});
	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.white');
	});
  });
		

  	  	$$('.hkdstr').each(function(img) {

	var asdd =CurrencyFormatted(img.get('text'));
	var asdd222 =CommaFormatted(asdd);
	img.set('html',asdd222); 
//	img.setStyle('border','1px solid #aaa'); 

  });
				
  	  	$$('.area_cma').each(function(img) {

	var asdd =CurrencyFormatted(img.get('text'));
	var asdd222 =CommaFormatted(asdd);
	img.set('html',asdd222); 
//	img.setStyle('border','1px solid #aaa'); 

  });
				
		
		
   	  	$$('.dd_btn').each(function(img) {
									 
									 
	img.addEvent('mouseover', function() { 
	this.getElements('a.noacc_title').setStyle('color','#000'); 
	this.getElements('p.size12').setStyle('color','#000'); 
	this.setStyle('border','1px solid #aaa'); 
	});
	img.addEvent('mouseout', function() { 
	this.getElements('a.noacc_title').setStyle('color','#666'); 
	this.getElements('p.size12').setStyle('color','#666'); 
	this.setStyle('border','1px solid #ccc'); 
	});

	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.noacc_title');
	//this.toggle();
	});

  });
  
  
  
  	
	 	$$('.change_thumb').each(function(img) {
									 
	var   thisalt_id =img.getElements('img.this_thumb').get('alt');
	var aathisalt_id= new String(thisalt_id)	
 var thisalt_src =img.getElements('img.this_thumb').get('src');
	var aathisalt_src= new String(thisalt_src)	
	

	var   rhw =img.get('lang').split(",");
	
	img.addEvent('mouseover', function() { 


	$(aathisalt_id).setAttribute("height",rhw[1]);
	$(aathisalt_id).setAttribute("width",rhw[0]);
	
	
	$(aathisalt_id).getParent().setAttribute("rev",this.get('id'));
	$(aathisalt_id).setAttribute("src",this.get('rev'));

	});
	img.addEvent('mouseout', function() { 
	//this.setStyle('background-color','#ffffff'); 
	});
	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.bold');
	//this.toggle();
	});
  });
		
  


	 	$$('.change_gallery').each(function(img) {
									 
	var   thisalt_id =img.getElements('img.this_thumb').get('alt');
	var aathisalt_id= new String(thisalt_id);	
 var thisalt_src =img.getElements('img.this_thumb').get('src');
	var aathisalt_src= new String(thisalt_src)	;
	
 var mainid_val =img.getParent().get('title');
	var mainid= new String(mainid_val)	;
	
	var   rhw =img.get('lang').split(",");
	
	img.addEvent('mouseover', function() { 


	$(aathisalt_id).setAttribute("height",rhw[1]);
	$(aathisalt_id).setAttribute("width",rhw[0]);
	
	
	$(aathisalt_id).getParent().setAttribute("rev",this.get('id'));
	$(aathisalt_id).setAttribute("src",this.get('rev'));

	});
	img.addEvent('mouseout', function() { 
	//$(aathisalt_id).setAttribute("src",this.get('rev'));

	var thissrc=$(mainid).get('rev');
	$(aathisalt_id).setAttribute("src",thissrc);


	});
	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.bold');
	//this.toggle();
	});
  });			
/*
  
    	  	$$('.round_btn').each(function(img) {
									 
	img.addEvent('mouseover', function() { 
	
if(this.get('id')!='red_cbtn')	{
	this.getElements('b.red_b').setStyle('background-position','0% 0%');
	this.getElements('a.red_a').setStyle('background-position','100% 0%');
	this.getElements('span.round_arrow_btn').setStyle('background-position','100% 0%');
	this.getElements('a.red_a').setStyle('text-decoration','none');
}
	});
	img.addEvent('mouseout', function() { 
if(this.get('id')!='red_cbtn')	{
	this.getElements('b.red_b').setStyle('background-position','0% 100%');
	this.getElements('a.red_a').setStyle('background-position','100% 100%');
	this.getElements('span.round_arrow_btn').setStyle('background-position','100% 100%');
}
	});
	img.addEvent('click', function() { 
	window.location.href=this.getElements('a.red_a');
	//this.toggle();
	});
  });
*/	

  
});	



var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}



	function setdisplay(setid){
	var op_all =$(setid);

	if(op_all.get('rev')==1){
	op_all.setStyle('display','none');
	op_all.setAttribute('rev','0');
	}else{
	op_all.setStyle('display','block');
	op_all.setAttribute('rev','1');
	//window.location.href="#comment";
	}
	
}


function selectprice(stp){
var stp=stp;
 var rp = $('rent_price');
var  sp= $('sale_price'); 

if(stp==1){
 rp.setStyle('display','none');
}else if(stp==2){
 rp.setStyle('display','none');
		
}else{
 rp.setStyle('display','none');
	
}


}














function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
function CommaFormatted(amount)
{
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n ; }
	amount = minus + amount;
	return amount;
}

 function addval(theval) {
  if(($('exf_blank8').checked==true) && ($('exf_blank8_name').value=="")){
	 $('exf_blank_check').value="asd";
 }else{
	 $('exf_blank_check').value=parseInt(theval); 
 }
  }

