/* ### This script is to be used when you need to get a contact us form opened within a new window. ### */

var winWidth = 450;
var winHeight = 520;
var subject = "";
var wantCategory = "no"; // Default
var cssPrefix = "BLUE";
var win = "";

function openContactUs(id){		

	var addressee = "";	
	var url = "http://www.jtbusa.com/common/aspscripts/contactusaswin.asp";
		
	if(win &&  win.closed == false){
		alert("You can only open one window at a time.\n Please close the other window first.");
		win.focus();
		return;
	}

	if(document.getElementById(id)){
		addressee = document.getElementById(id).title;
	}

	url += "?id=" + id;
	url += "&addressee=" + addressee;
	url += "&emailSent=no";
	url += "&wantCategory=" + wantCategory;
	url += "&subject=" + subject;
	url += "&prefix=" + cssPrefix;
	
	properties = "width=" + winWidth + ",";
	properties += "height=" + winHeight + ",";
	properties += "left=" + getWinLeftPos(winWidth) + ",";
	properties += "top=" + getWinTopPos(winHeight) + ",";
	properties += "titlebar=no,toolbar=no,location=no,resizable=no,status=0,scrollbars=no";

	win = window.open(url,"",properties);	
}	

function setSubject(sub){
	if(sub != "") subject = sub;
}

function setCssPrefix(prefix){
	if(prefix != "") cssPrefix = prefix;
}

function setWantCategory(want){
	if(want != "") wantCategory = want;
}

function setWinWidth(width){
	if(width > 450) winWidth = width;	
}

function setWinHeight(height){
	if(height> 520) winHeight = height;	
}

function getWinTopPos(height){

	var posTop = 0;		
	var pageHeight = window.screen.height;		

	posTop = (pageHeight - height) / 2;

	return posTop;	
}

function getWinLeftPos(width){

	var posLeft = 0;	
	var pageWidth = window.screen.width;	

	posLeft = (pageWidth - width) / 2;	

	return posLeft;	
}

function closeContactUs(){
	win.close();
}