window.status="Area de Administracion";
function showorhide(id)
{
   alert(document.getElementById(id));
   if(document.getElementById(id))
{    //check the element exists and can be accessed
       var ele = document.getElementById(id);    //get hold of the element
       if(ele.style.display=="none"){   //see if display property is set to none, show the box
           ele.style.display="block";       
       }else{
           ele.style.display="none";     
       }
   }
}
function editaCuarto(detalle,tipo,id){
	window.open('../modules/popup/editaCuarto.php?detalle='+detalle+'&tipo='+tipo+'&id_inm='+id,'edita','left=100,top=100,width=700,height=300');
}
function popup(dir,left,top,w,h){
	window.open(dir,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=0,menubar=0,scrollbars=0');
}
function reqschedule(inm,left,top,w,h){
	window.open('/listings/schedule.php?inm='+inm,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=0,menubar=0,scrollbars=0');
}
function additionalinfo(inm,left,top,w,h){
	window.open('/listings/additionalinfo.php?inm='+inm,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=0,menubar=0,scrollbars=0');
}
function sendlisting(inm,listing,left,top,w,h){
	window.open('/listings/sendfriend.php?inm='+inm+'&url='+listing,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=0,menubar=0,scrollbars=0');
}
function newInm(msg){
	var cf;
	cf=confirm(msg);
	if(cf==true){ 
		window.location='../modules/agr_inmueble.php?nuevo=1';
	}else{
		window.location.href='index.php';
	}	
}
function orden(id,orden,dir){
	window.location.href="imgSys.php?act=orden&id="+id+"&order="+orden+"&dir="+dir;
}
function delphoto(id,orden){
	window.location.href="imgSys.php?act=del&id="+id+"&order="+orden;
}
function actualiza(){
	var op = window.opener;
	op.location.reload();
}
function actualiza2(id){
	var op = window.opener;
	op.location.href='../modules/imgSys.php?id='+id;
}

function printflyer(id_inm,left,top,w,h,lang){
	if (lang=="en")
	window.open('/includes/printflyer.php?lang=en&id_inm='+id_inm,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=1,menubar=0,scrollbars=1');
	if (lang=="es")
	window.open('/includes/printflyer.php?lang=es&id_inm='+id_inm,'','top='+top+',left='+left+',width='+w+',height='+h+',toolbar=0,resizable=0,location=0,status=1,menubar=0,scrollbars=1');
}
function setState(id,state){
	window.location.href="index.php?act=cst&id="+id+"&state="+state;
}
function setActiveState(id,state){
	window.location.href="edt_inmueble.php?act=cst&id="+id+"&state="+state;
}
function updateMainframe(url){
	/*if(typeOf(top.mainframe != 'undefined'){
        top.mainframe.document.target.value = targetFrameName;
	}else{
        ...delayFunction()...
	}*/
	message(url);
	top.mainframe.location=url;
}
function sel_photo(id_inm,order)
{
	window.location.href=id_inm+"-"+order;
}
function clicktext()
{	
	document.frm_mlssearch.v_mls_num.focus();
    document.frm_mlssearch.v_mls_num.select(); 
	//document.frm_mlssearch.v_mls_num.value="";
}

function update_list(formulario,label)
{
	var index=formulario.v_contrato.selectedIndex;
	formulario.v_ivalor.length=0;
	
	if(index==0) {
		blank1();
	}
	if(index==2) {
		valoresi2(label);
		valoresf2(label);
	}
 	if(index==1)
 	{
 		valoresi1(label);
 		valoresf1(label);
 	}
}

function update_list2(label)
{
	var c=document.frm_busca.v_contrato.selectedIndex;
	if(c==0) {
		blank1(label);
	}
	if(c==1)
 	{
 		valoresi1(label);
 		valoresf1(label);
 	}
	if(c==2) {
		valoresi2(label);
		valoresf2(label);
	}
}
function blank1()
{
	opcion0=new Option("","-1","defauldSelected");
	document.frm_busca.v_ivalor.disabled=true;
	document.frm_busca.v_fvalor.disabled=true;
}
function valoresi1(label)
{	
	document.frm_busca.v_ivalor.disabled=false;
	opcion0=new Option("Seleccione","-1","defauldSelected");	
	opcion1=new Option("100.000","1");
	opcion2=new Option("500.000","2");
	opcion3=new Option("1.000.000","3");
	opcion4=new Option("1.500.000","4");
	opcion5=new Option("2.000.000","5");
	opcion6=new Option("2.500.000","6");
	
	document.frm_busca.v_ivalor.options[0]=opcion0;
	document.frm_busca.v_ivalor.options[1]=opcion1;
	document.frm_busca.v_ivalor.options[2]=opcion2;
	document.frm_busca.v_ivalor.options[3]=opcion3;
	document.frm_busca.v_ivalor.options[4]=opcion4;
	document.frm_busca.v_ivalor.options[5]=opcion5;
	document.frm_busca.v_ivalor.options[6]=opcion6;
}
function valoresf1(label)
{	
	document.frm_busca.v_fvalor.disabled=false;
	opcion0=new Option("Seleccione","-1","defauldSelected");	
	opcion1=new Option("500.000","1");
	opcion2=new Option("1.000.000","2");
	opcion3=new Option("1.500.000","3");
	opcion4=new Option("2.000.000","4");
	opcion5=new Option("2.500.000","5");
	opcion6=new Option(label+"3.000.000","MAX");
	
	document.frm_busca.v_fvalor.options[0]=opcion0;
	document.frm_busca.v_fvalor.options[1]=opcion1;
	document.frm_busca.v_fvalor.options[2]=opcion2;
	document.frm_busca.v_fvalor.options[3]=opcion3;
	document.frm_busca.v_fvalor.options[4]=opcion4;
	document.frm_busca.v_fvalor.options[5]=opcion5;
	document.frm_busca.v_fvalor.options[6]=opcion6;
}
function valoresi2(label)
{	
	document.frm_busca.v_ivalor.disabled=false;
	opcion0=new Option("Seleccione","-1","defauldSelected");	
	opcion1=new Option("50.000","1");
	opcion2=new Option("100.000","2");
	opcion3=new Option("200.000","3");
	opcion4=new Option("300.000","4");
	opcion5=new Option("500.000","5");
	opcion6=new Option("700.000","6");
	
	document.frm_busca.v_ivalor.options[0]=opcion0;
	document.frm_busca.v_ivalor.options[1]=opcion1;
	document.frm_busca.v_ivalor.options[2]=opcion2;
	document.frm_busca.v_ivalor.options[3]=opcion3;
	document.frm_busca.v_ivalor.options[4]=opcion4;
	document.frm_busca.v_ivalor.options[5]=opcion5;
	document.frm_busca.v_ivalor.options[6]=opcion6;
}
function valoresf2(label)
{
	document.frm_busca.v_fvalor.disabled=false;
	opcion0=new Option("Seleccione","-1","defauldSelected");	
	opcion1=new Option("100.000","1");
	opcion2=new Option("200.000","2");
	opcion3=new Option("300.000","3");
	opcion4=new Option("500.000","4");
	opcion5=new Option("700.000","5");
	opcion6=new Option(label+"900.000","MAX");
	
	document.frm_busca.v_fvalor.options[0]=opcion0;
	document.frm_busca.v_fvalor.options[1]=opcion1;
	document.frm_busca.v_fvalor.options[2]=opcion2;
	document.frm_busca.v_fvalor.options[3]=opcion3;
	document.frm_busca.v_fvalor.options[4]=opcion4;
	document.frm_busca.v_fvalor.options[5]=opcion5;
	document.frm_busca.v_fvalor.options[6]=opcion6;
}

function validator(label)
{	
	var x1=document.frm_busca.v_ivalor.value
	var x2=document.frm_busca.v_fvalor.value
	if(x1!=-1&&x2!=-1){
	if(x1>x2){
	alert(label);
	x2=0;
	x1=0;
	return false;
	}
	}else{
	return true;
	}
}
function detailOffice(idOficina){
	window.location.href='/our_team/office/'+idOficina;
}