// use the most friendly method possible (try to reduce the possibility of throwing errors)
createTryHandler = function(){
  if(document.createTryHandler_init) return;
  document.createTryHandler_init = true;

  var sHTML = ''
  +'<SC'+'RIPT LANGUAGE="JavaSc'+'ript1.5">'
  +'document.j15TryHandler = function(){'
  +'  try{'
  +'    window.opener.document.ivanUrlSubmit.submit()'
  +'  }'
  +'  catch(err){}'
  +'}'
  +'</SC'+'RIPT>'
  document.write(sHTML)
}
createTryHandler()


function tourwinclose(url) {
	if (url) {}
	else {
		if (window.opener&&!window.opener.closed){
			url = window.opener.document.location;
		} else {
			url = location.host || "http://www.bizhosting.com/";
		}
	}
	if (window.opener&&!window.opener.closed){

  // see if the opener has a special form for passing query string variables forward
  if(document.j15TryHandler) document.j15TryHandler()
  else{
    if(window.opener.document && window.opener.document.ivanUrlSubmit){ 
      //for Nate, allows pass of link_id or refer_id
      window.opener.document.ivanUrlSubmit.submit()
  		window.close();
    }
    else{
  		window.opener.document.location=url;
  		window.opener.focus();
  		window.close();
    }
  }

	} else {
		if (window.name=="BHTOUR"){
			bhwindow=window.open(url,"Bizhosting","");
			bhwindow.focus();
			window.close();
		} else {
			document.location=url;
		}
	}
}
function tourwinopen(url){
	sah=screen.availHeight;
	saw=screen.availWidth;
	sh=sah;
	sw=saw;
	if (sh>580) sh=580;
	if (sw>780) sw=780;
	st=(sah-sh)/2;
	sl=(saw-sw)/2;
	bhtourprops="width="+sw+",height="+sh+",resizable=yes,scrollbars=yes,left="+sl+",screenX="+sl+",top="+st+",screenY="+st;
	tourwin=window.open(url,"BHTOUR",bhtourprops);
	tourwin.focus();
}
