
function writeObj(obj) {
trimString(obj);
document.write(obj);
}
function trimString (str) {
  var pattern = /\s+/g;
  return str.replace(pattern,'');
}



//popup functionality
window.onerror=null;
var win = null;
function PopWindow(mypage,myname) {
	//closePopWin();
	winprops = 'height=500,width=820,top=30,left=0,scrollbars=1,resizable=1,status=1';
	win = window.open(mypage, myname, winprops);
	}
function SizedPopWindow(mypage,myname,w,h) {
	//closePopWin();
	winprops = 'height='+h+',width='+w+',top=30,left=0,scrollbars=1,resizable=1,status=1';
	win = window.open(mypage, myname, winprops);
	}
function closePopWin() {
	if(win != null) { 
		if(!win.closed) { 
			win.close();
			win = null;
			} else {
			win = null;
			}
		}	
	}
	
function Validator(theSurvey)
{
  var radioSelected = false;
  for (i = 0;  i < theSurvey.choice.length;  i++)
  {
    if (theSurvey.choice[i].checked)
        radioSelected = true;
  }
   if (!radioSelected)
  {
    alert("Oops, usted se olvidó de seleccionar lo que usted está buscando.");
    return (false);
  }

  return true;
 }

function openWindow(passed_url,passed_window)
{
      directionsWindow=window.open(passed_url,passed_window,'toolbar=1,location=0,directories=0,status=1,menubar=1,resizable=1,scrollbars=1,width=392,height=550,screenX=30,screenY=30,top=30,left=30')
 directionsWindow.focus()
}
function openWindow2(passed_url,passed_window)
{
        gameWindow=window.open(passed_url,passed_window,'toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=1,scrollbars=0,width=510,height=330,screenX=30,screenY=30,top=30,left=30')
 gameWindow.focus()
}



// rotate touts on home page
function rotateTout() {
	if (!document.getElementById) return true;
	var touts = $('rotateTouts').getElementsByTagName('a');
	var tRand = Math.floor(Math.random()*(touts.length));
	touts[tRand].style.display = "block";
	if ($('tout04'))
	{
	    $('tout04').style.display = "block";
	}
}
