var s3 = null;
var s8 = null;
var newframer = '<HTML><HEAD><TITLE>GoTour</TITLE></HEAD><frameset cols="*" frameborder="NO" border="0" framespacing="0"><frame name="scrollFrame" src="empty.html" scrolling="auto"></frameset><noframes><body bgcolor="#FFFFFF"></noframes></BODY></HTML>';



function openAddComment (story_type, story_id, session_id) {
	if(s3!=null && !s3.closed) {
		s3.top.location = "add_comment.html?" + story_type + "=" + story_id +  "&e_e=" + session_id;
		window.s3.resizeTo(300, 500);
		s3.top.focus();
	} else {
		s3 = window.open("add_comment.html?" + story_type + "=" + story_id +  "&e_e=" + session_id,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=300,height=500');
	}
}

function openReadComments (story_type, story_id, session_id) {	
	if(s3!=null && !s3.closed) {
		s3.top.location = 'sc_load.html?pageload=' + 'read_comments.html&' + story_type + "=" + story_id +  "&e_e=" + session_id;
		window.s3.resizeTo(420, 300);
		s3.top.focus();
	} else {
		s3 = window.open('sc_load.html?pageload=' + 'read_comments.html&' + story_type + "=" + story_id +  "&e_e=" + session_id,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=420,height=300');
	}
}


function openRegions(){
	if(s3!=null && !s3.closed) {
		s3.top.location = 'regions.html';
		window.s3.resizeTo(550, 330);
		s3.top.focus();
	} else {
		s3 = window.open('regions.html','s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=550,height=330');
	}
}

function openLogin(session){
	if(s3!=null && !s3.closed) {
		s3.top.location = 'login.html?e_e=' + session;
		window.s3.resizeTo(360, 260);
		s3.top.focus();
	} else {
		s3 = window.open('login.html?e_e=' + session,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=370,height=260');
	}
}

function openNoReloadLogin(session){
	if(s3!=null && !s3.closed) {
		s3.top.location = 'nlogin.html?e_e=' + session;
		window.s3.resizeTo(360, 260);
		s3.top.focus();
	} else {
		s3 = window.open('nlogin.html?e_e=' + session,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=370,height=260');
	}
}


function openSearchtips(pagename){

	var nombre = null;
	var sheight = null;
	var swidth = null;
	
	var namecheck = pagename;
	
	if (pagename == 'dest') {
		nombre = 'searchtips_dest.html';
		sheight = 500;
		swidth = 450;
	}
	
	if (pagename == 'prov') {
		nombre = 'searchtips_prov.html';
		sheight = 500;
		swidth = 450;
	}
	
	if (pagename == 'guides') {
		nombre = 'searchtips_guides.html';
		sheight = 550;
		swidth = 450;
	}
	
	if (pagename == 'share') {	
		nombre = 'searchtips_share.html';
		sheight = 500;
		swidth = 450;
	}
	
	if (nombre == null) {
		nombre = 'searchtips_prov.html';
		sheight = 500;
		swidth = 450;
	}
	if(s3!=null && !s3.closed) {
		s3.top.location = nombre;
		window.s3.resizeTo(swidth, sheight);
		s3.top.focus();
	} else {
		window.open(nombre,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=' + swidth + ',height=' + sheight);
	}
}
		
function openVariousRegions(idnum, session){		
	var fullurl = "various_regions.html?artnum=" + idnum + "&" + "e_e=" + session;
	if(s3!=null && !s3.closed) {
		s3.top.location = fullurl;
		window.s3.resizeTo(150, 250);
		s3.top.focus();
	} else {
		s3 = window.open(fullurl ,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=150,height=250');
	}
}

function openClassVariousRegions(idnum, session){		
	var fullurl = "class_various_regions.html?classnum=" + idnum + "&" + "e_e=" + session;
	if(s3!=null && !s3.closed) {
		s3.top.location = fullurl;
		window.s3.resizeTo(150, 250);
		s3.top.focus();
	} else {
		s3 = window.open(fullurl ,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=150,height=250');
	}
}

function openLogout(session){
	if(s3!=null && !s3.closed) {
		s3.top.location = "login.html?e_e=" + session;
		window.s3.resizeTo(415, 265);
		s3.top.focus();
	} else {
		s3 = window.open("login.html?e_e=" + session ,'s3','toolbar=0,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=415,height=265');
	}
	location=location;
}

function openPrintFriendly(page){
	if(s8!=null && !s8.closed) {
		s8.top.location = 'sc_load.html?pageload='+ page;
		window.s8.resizeTo(600, 650);
		s8.top.focus();
	} else {
		s8 = window.open('sc_load.html?pageload='+ page,'s8','toolbar=1,menubar=0,resizable=0,marginwidth=0,marginheight=0,scrollbars=no,location=0,status=0,width=600,height=650');
	}
}


function closeWindow(){
		window.close();
	}
	

	
function closeWindowAndRedirect(page){
		window.opener.location=page;
		window.close();
	}
	


function redirectOpenerNew(){
	var a4 = window.opener.top.location;
	
	alert(a4);
	
	if (a4!=null && a4!='') {
		alert("good");
		//window.opener.top.location.reload();
		//window.opener.top.location.replace(a4);
	} else {
		alert('you found a bug!  Please contact jhorland@jhorland.com to help gotour fix bugs!');
	}
	
	//parent.window.opener.top.location = parent.window.opener.top.location;
}
	
	

function closeConfigWin() {
	if(s3!=null && !s3.closed)window.s3.close();
}
