/*
* javascript controller for globalnsure
*
*/


// form cancel
function formCancel(loc){
	window.location = loc;
}

// opens plan details
function openPlan(name){
	xHeight = parseInt((screen.height/2) - 100); 
	yWidth = parseInt((screen.width/2) - (175/2));
	
	var winFeatures='width=550,';			// width of window
	winFeatures += 'height=300,';			// height of window
	winFeatures += 'toolbar=yes,';			// toolbars
	winFeatures += 'titlebar=no,';			// titlebar
	winFeatures += 'location=no,';			// location
	winFeatures += 'directories=no,';		// directories
	winFeatures += 'status=no,';			// status
	winFeatures += 'menubar=no,';			// menubar
	winFeatures += 'scrollbars=yes,';		// scrollbars
	winFeatures += 'resizeable=no,'	;		// resizable
	winFeatures += 'copyhistory=no,';		// copy history
	winFeatures += 'top='+ xHeight+',';		// ie specific top
	winFeatures += 'left='+ yWidth + ',';		// ie specific left positioning		
	winFeatures += 'screenX='+ xHeight+',';		// ns specific top positioning
	winFeatures += 'screenY='+ yWidth + '';		// ns specific left pos
	
	var fileLoc = name;
	var planName = "jsp/" + fileLoc  + "/printablePlan.jsp";
	
	//window.open('tools/cal.jsp?n='+ name +'','sub',winFeatures);
	window.open(planName,'sub',winFeatures);
	//alert(planName);
}

// open the calendar control 
function openCal(name){
	xHeight = parseInt((screen.height/2) - 100); 
	yWidth = parseInt((screen.width/2) - (175/2));
	
	var winFeatures='width=275,';			// width of window
	winFeatures += 'height=200,';			// height of window
	winFeatures += 'toolbar=no,';			// toolbars
	winFeatures += 'titlebar=no,';			// titlebar
	winFeatures += 'location=no,';			// location
	winFeatures += 'directories=no,';		// directories
	winFeatures += 'status=no,';			// status
	winFeatures += 'menubar=no,';			// menubar
	winFeatures += 'scrollbars=no,';		// scrollbars
	winFeatures += 'resizeable=no,'	;		// resizable
	winFeatures += 'copyhistory=no,';		// copy history
	winFeatures += 'top='+ xHeight+',';		// ie specific top
	winFeatures += 'left='+ yWidth + ',';		// ie specific left positioning		
	winFeatures += 'screenX='+ xHeight+',';		// ns specific top positioning
	winFeatures += 'screenY='+ yWidth + '';		// ns specific left pos
	
	window.open('tools/cal.jsp?n='+ name +'','sub',winFeatures);
}

function jumpMenu(loc){
	var d = " " + loc + ".do";
	window.location = d; 
	//alert(d);
}

// opens new window for mnui plans
function openMnuiPlan(plan){
	var loc = "";
	//alert(plan);
	// atlas
	if (plan == "atlas"){
		loc = 'https://www.worldtrips.com/quotes/atlas/default.asp?referID=22176';
	}
	// international citizen
	if(plan == 'intl'){
		loc = 'https://www.worldtrips.com/quotes/ic/default.asp?referID=22176';
	}
	
	//IC+ International Term Life 
	if(plan == "itc"){
		loc = 'https://www.worldtrips.com/quotes/life/default.asp?referID=22176';
	}
	
	//MultiNational Accident Plan
	if(plan == 'multi'){
		loc = 'https://www.quote-and-apply.com/accident/?referid=22176';
	}
	
	// life or term
	if(plan == 'life'){
		loc = 'https://www.worldtrips.com/quotes/life/default.asp?referID=22176';
	}
	//alert(loc);
	window.open(loc,'','');
	
}	

// for showing different images in the global tiles
function showImg(loc){
	//alert(loc);
	var img;	
	//var loc = document.location;
	if(loc == "http://www.globalnsure.com/contact.do"){
		img = "contactSub.jpg";				
	}else if(loc == "http://localhost:8080/globalnsure/contact.do"){
		// testing only !@
		img = "contactSub.jpg";
	}else if(loc == "http://www.globalnsure.com/ContactForm.do"){
		img = "contactSub.jpg";
		
	}else{
		img = "pxl.gif";
	}
	var theImg = '<img src=images/' + img + '>';
	return theImg;
}