function mformsubmit(){
box=document.form1.terms;
//alert(box.checked);
if (box.checked==false)
{alert('Please read our terms and conditions on this page and check the box "I agree"');
box.focus();
return;
}
else{
document.form1.submit();
}
}

//metro tools start from here down
function testalert(){
alert('test2 ok');
}


function checkFieldEnter(fieldkey,field){ 
var characterCode //literal character code will be stored in this variable

if(fieldkey && fieldkey.which){ //if which property of event object is supported (NN4)
characterCode = fieldkey.which //character code is contained in NN4's which property
}
else{
fieldkey = event
characterCode = fieldkey.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
if (field=='password'){
userVerify(getInputValue(document.form1.email),getInputValue(document.form1.pw2));
}
if (field=='emaillogin'){
userLogin(getInputValue(document.form1.email));

}
return false ;
}
else{
return true ;
}

}

function getT(){
var d = new Date();
var t = d.getTime();
//alert(t)
return t;
}

function checkAll(form,check){
//alert(cid);
for (i=0;i<form.cboxes.length;i++){
if (check==true){
form.cboxes[i].checked=true;}
else{form.cboxes[i].checked=false;}
}
if (check==true){
writit('<span style="font-size: 8pt"><a href="javascript:checkAll(document.form1,false);">Uncheck all ('+nm+')</a></span>','cbox');
}
else{
writit('<span style="font-size: 8pt"><a href="javascript:checkAll(document.form1,true);">Check all ('+nm+')</a></span>','cbox');
}

}


function highlightRow(alnid){
//alert('alnid');  
  var ltable=document.getElementById('legendtable');
  //ltable.style.backgroundColor='blue';  
    var rows = ltable.getElementsByTagName("TR");   
  // alert (rows.length);

   for(i = 0; i < rows.length ; i++){           
//alert(rows[i].getAttribute('alngroup'));
if (rows[i].getAttribute('alngroup')==alnid){
rows[i].style.backgroundColor='FFFFCC';
}
else {rows[i].style.backgroundColor='white';}

}
 //   document.getElementById(alnid).style.backgroundColor="#0000FF";
      
  }
function highlightTable(id,color){
//alert('alnid');  
  var ltable=document.getElementById(id);
  ltable.style.backgroundColor=color;  
   
  }
 
  



function showhidelayer(id,showhide) { 

if (document.all) { 
if (showhide==true){document.all[id].style.visibility = "visible";}
else{document.all[id].style.visibility = "hidden"; }
}
 
if(document.layers){ 
if (showhide==true){document.layers[id].visibility = "show";}
else{document.layers[id].visibility = "hide";} 
}

if(document.getElementById) {
if (showhide==true){document.getElementById(id).style.visibility='visible';}
else{document.getElementById(id).style.visibility='hidden';} 
}
}
function showhidelayer2(id,showhide) { 

if (document.all) { 
if (showhide==true){document.all[id].style.display = "block";}
else{document.all[id].style.display= "none"; }
}
 
if(document.layers){ 
if (showhide==true){document.layers[id].display = "block";}
else{document.layers[id].display= "none";} 
}

if(document.getElementById) {
if (showhide==true){document.getElementById(id).style.display='block';}
else{document.getElementById(id).style.display='none';} 
}
}


function showhidebox(id,tg) { 


if (document.all) { 
if (document.all[id].style.display=="none"){document.all[id].style.display = "block";
//alert(document.all[id].style.diplay);
writit('<img src="minus.png"; style="border: none";>',tg);}
else{document.all[id].style.display = "none"; 
writit('<img src="plus.png"; style="border: none";>',tg);}
return ;
}
 
if(document.layers){ 
if (document.layers[id].display =="none"){document.layers[id].display= "block";
writit('<img src="minus.png"; style="border: none";>',tg);
}
else{document.layers[id].display= "none";} 
writit('<img src="plus.png"; style="border: none";>',tg);
return ;
}


if(document.getElementById) {
if (document.getElementById(id).style.display=="none"){
document.getElementById(id).style.display='block';
writit('<img src="minus.png"; style="border: none";>',tg)}
else{document.getElementById(id).style.display='none';
writit('<img src="plus.png"; style="border: none";>',tg)} 
return ;
}

}

function closeAll() { 

var boxes=new Array('petstable','pricetable','sqfttable','bedbathtable','propagetable','othercriteriatable');
var toggle=new Array('petsplusminus','priceplusminus','sqftplusminus','bedbathplusminus','propageplusminus','othercriteriaplusminus');

for (i=0;i<boxes.length;i++){

if (document.all) { 
document.all[boxes[i]].style.display = "none"; 
writit('<img src="plus.png"; style="border: none";>',toggle[i]);
}
 
if(document.layers){ 
document.layers[boxes[i]].display= "none"; 
writit('<img src="plus.png"; style="border: none";>',toggle[i]);
}


if(document.getElementById) {
document.getElementById(boxes[i]).style.display='none';
writit('<img src="plus.png"; style="border: none";>',toggle[i]);
}

}//end for loop

showhidebox2('amenitytable','amenityplusminus',true);
}


function showhidebox2(id,tg,showhide) { 


if (document.all) { 
if (showhide==true){document.all[id].style.display = "block";
//alert(document.all[id].style.diplay);
writit('<img src="minus.png"; style="border: none";>',tg);}
else{document.all[id].style.display = "none"; 
writit('<img src="plus.png"; style="border: none";>',tg);}
return ;
}
 
if(document.layers){ 
if (showhide==true){document.layers[id].display= "block";
writit('<img src="minus.png"; style="border: none";>',tg);
}
else{document.layers[id].display= "none";} 
writit('<img src="plus.png"; style="border: none";>',tg);
return ;
}


if(document.getElementById) {
if (showhide==true){
document.getElementById(id).style.display='block';
writit('<img src="minus.png"; style="border: none";>',tg)}
else{document.getElementById(id).style.display='none';
writit('<img src="plus.png"; style="border: none";>',tg)} 
return ;
}

}


function showhidetable(id,showhide) { 


if (document.all) { 
if (showhide==true){document.all[id].style.display = "block";
//alert(document.all[id].style.diplay);
}
else{document.all[id].style.display = "none"; 
}
return ;
}
 
if(document.layers){ 
if (showhide==true){document.layers[id].display= "block";
}
else{document.layers[id].display= "none";} 
return ;
}


if(document.getElementById) {
if (showhide==true){
document.getElementById(id).style.display='block';
}
else{document.getElementById(id).style.display='none';
} 
return ;
}

}




    
    function writit(responsetext,id)
{


		text = responsetext;
	
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}	else if (document.layers)
	{
		x = document.layers[id];
		x.document.open();
		x.document.write(text);
		x.document.close();
	}
}


    
  
function mparse(starttag,endtag,textstring){

var startpos=textstring.indexOf(starttag)+starttag.length;
var endpos= textstring.indexOf(endtag);
return textstring.substring(startpos,endpos);

}


