// JavaScript Document

//Globals
var pageURLArgs = new Object();

function change_feature_pix(selObj, newimagepath){
	
}
function MM_jumpPage(selObj,restore){
	if(selObj.selectedIndex == 0)
		return;	
	window.open(selObj.options[selObj.selectedIndex].value);
	if(restore)
		selObj.selectedIndex=0;
}

// ROLLOVER

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// LOGINBOX

function loginbox(){
document.write('<h6>Your Online Access</h3>');
document.write('<p>If you are a <a href="template-client.html">Client</a>, <a href="#">Employee</a> or <a href="template-np.html">Network Partner</a>, please log in to your IGP dedicated site for select information and resources.</p>');		
}

function loginbox2(){
document.write('<h6>Your Online Access</h3>');
document.write('<p>If you are a Client, Employee or Network Partner, please log in to your IGP dedicated site for select information and resources.</p>');		
document.write('<p><input name="login" type="text" id="login" size="" class="loginfield"/>');	
document.write('<img src="images/login.jpg" alt="login" name="login" width="54" height="25" id="login" onmouseover="MM_swapImage(\'login\',\'\',\'images/login-over.jpg\',1)" onmouseout="MM_swapImgRestore()" /></p>');	
}



function clientlogin(cName){
document.write('<h6>');
document.write(cName);
document.write('</h3>');
document.write('<p><span style="color:#007dc3;"><em>Welcome to Your IGP Website!</em></span><br><br> We are pleased to provide you with this valuable source of information on your IGP account.</p>');		
}

function nplogin(npName){
document.write('<h6>');
document.write(npName);
document.write('</h3>');
document.write('<p><span style="color:#007dc3;"><em>Welcome to Your IGP Website!</em></span><br><br> This website contains valuable tools to support your efforts to sell, retain and administer IGP business.</p>');		
}

function legalbox(){
document.write('<div id="legal">');
document.write('<p>COPYRIGHT 1999-2011 by John Hancock Life Insurance Company U.S.A., Boston, MA 02117<br> <a href="legal.php" class="legallink">Important Legal Information</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="copyright.php" class="legallink">Copyright Information</a></p>');
document.write('</div>');	
}

// MAIN NAVIGATION

function mainnav(pageName)
{	
	var expand_section;
	switch(pageName)
	{
	case 'igpadvantage':
	case 'yourbestchoice':
	case 'multipooling':
	case 'intldividend':
	case 'internationalexperiencereport':
	case 'countryprofiles':
	case 'networknews':
	case 'faq':
	case 'about':
	expand_section='igpadvantage';
	break;
	case 'partners':
	case 'map':
	case 'localadv':
	expand_section='partners';
	break;
	case 'products':
	case 'types':
	case 'cashflow':
	case 'third':
	expand_section='products';
	break;
	default:
	expand_section ='';
	break;
	}
	
	
	document.write('<div id="mainnav">');
	document.write('<a href="/igpinfo/index.php"><img src="/igpinfo/images/logo.jpg" border="0"></a>');
	document.write('<br><br>');
	document.write('<ul id="navigation" class="main">');
	document.write('<li id="homepage"><a href="/igpinfo/index.php" ><img src="/igpinfo/images/navigation/home.gif" border="0" height="30" name="home" id="home"></a></li>');
	document.write('<li class="divider"></li>');  


	document.write('<li id="igpadvantage"><a href="/igpinfo/igpadvantage/igp-advantage.php" ><img src="/igpinfo/images/navigation/igp-advantage.gif" border="0" height="30" name="igpadvantagepic" id="igpadvantagepic"></a>');
	
	if (expand_section == 'igpadvantage'){
		document.getElementById('igpadvantagepic').src = "/igpinfo/images/navigation/igp-advantage-over.gif";
		document.write('<ul class="subnavlinks">');
		document.write('<li><a id="yourbestchoice" href="/igpinfo/igpadvantage/yourbestchoice.php">IGP: Your Best Choice</a></li>');
		document.write('<li><a id="multipooling" href="/igpinfo/igpadvantage/multinationalpooling.php" >Multinational Pooling</a></li>');
		document.write('<li><a id="intldividend" href="/igpinfo/igpadvantage/internationaldividend.php">International Dividend</a></li>');
		document.write('<li><a id="internationalexperiencereport" href="/igpinfo/igpadvantage/internationalexperiencereport.php" >International Experience Report</a></li>');
		document.write('<li><a id="countryprofiles" href="/igpinfo/igpadvantage/countryprofiles.php">Country Profiles</a></li>');
		document.write('<li><a id="networknews" href="/igpinfo/igpadvantage/networknews.php">Network News</a></li>');
		document.write('<li><a id="faq" href="/igpinfo/igpadvantage/faq.php">FAQs</a></li>');
		document.write('<li><a id="about" href="/igpinfo/igpadvantage/about.php">About Us</a></li>');
		document.write('</ul>');
			
	}
	document.write('</li>');
	
	document.write('<li class="divider"></li>');   
	
	
	document.write('<li id="partners"><a href="/igpinfo/networkpartners/networkpartners.php"><img src="/igpinfo/images/navigation/partners.gif" border="0" id="partnerspic" name="partnerspic"  height="30"></a>');
	if (expand_section == 'partners'){
				document.getElementById('partnerspic').src = "/igpinfo/images/navigation/partners-over.gif";
document.write('<ul  class="subnavlinks">');
document.write('<li><a id="localadv" href="/igpinfo/networkpartners/ournetwork.php">Our Network:<br>Your Local Advantage</a></li>');
document.write('<li><a id="map" href="/igpinfo/networkpartners/yourlocallinktoigp.php">Your Local Link to IGP</a></li></ul>');
	}
	document.write('</li>');
	
	document.write('<li class="divider"></li>');   
	
	
	document.write('<li id="products"><a href="/igpinfo/products/products.php"><img src="/igpinfo/images/navigation/products.gif" border="0" id="productspic" name="productspic" height="30"></a>');
	if (expand_section == 'products'){
			document.getElementById('productspic').src = "/igpinfo/images/navigation/products-over.gif";
document.write('<ul  class="subnavlinks">');
document.write('<li><a id="types"  href="/igpinfo/products/typesofarrangements.php">Types of Arrangements</a></li>');
document.write('<li><a id="cashflow"  href="/igpinfo/products/cashflow.php">Improving Cash Flow<br>and Managing Risk</a></li>');
document.write('<li><a id="third"  href="/igpinfo/products/thirdcountrynationals.php">Third-Country Nationals<br>& Expatriates</a></li>');
document.write('</ul>');
}
document.write('</li>');

document.write('<li class="divider"></li>');   	
document.write('<li id="seminars"><a href="seminars-and-events.php" class="navlink"><img src="/igpinfo/images/navigation/seminars-events.gif" border="0"  height="30" id="seminarspic" name="seminarspic"></a></li>');  
document.write('<li class="divider"></li>');    
document.write('<li id="careers"><a href="careers.php" class="navlink"><img src="/igpinfo/images/navigation/careers.gif" border="0"  height="30" id="careerspic" name="careerspic"></a></li>');
document.write('<li class="divider"></li>');    
document.write('<li id="contact"><a href="contact.php" class="navlink"><img src="/igpinfo/images/navigation/contact.gif" border="0"  height="30" id="contactpic" name="contactpic"></a></li>');
    
if (pageName == 'homepage'){
	document.getElementById('home').src = "/igpinfo/images/navigation/home-over.gif";
document.write('<p>&nbsp;</p>');
document.write('<div id="upcoming-events" align="right">');
document.write('<p><span class="seminarname">IGP Asia-Pacific Employee Benefits Seminar</span><br>');
document.write('The Ritz-Carlton<br>');
document.write('Hong Kong<br>');
document.write('September 8, 2011<br>');
document.write('<a href="mailto:email@email.com" class="bluem">Click Here to Register</a></p>');
document.write('<p>&nbsp;</p>');
document.write('<p><span class="seminarname">Benefits & Multinational Pooling Training Workshop</span><br>');
document.write('IGP Europe Office<br>');
document.write('Brussels<br>');
document.write('October 2011<br>');
document.write('<a href="mailto:email@email.com" class="bluem">Click Here to Register</a></p>');
document.write('</div>');
}


if (pageName == 'loginsearch'){
document.write('<p>&nbsp;</p>');
document.write('<div id="upcoming-events" align="right">');
document.write('<p><span class="seminarname">IGP Asia-Pacific Employee Benefits Seminar</span><br>');
document.write('The Ritz-Carlton<br>');
document.write('Hong Kong<br>');
document.write('September 8, 2011<br>');
document.write('<a href="mailto:email@email.com" class="bluem">Click Here to Register</a></p>');
document.write('<p>&nbsp;</p>');
document.write('<p><span class="seminarname">Benefits & Multinational Pooling Training Workshop</span><br>');
document.write('IGP Europe Office<br>');
document.write('Brussels<br>');
document.write('October 2011<br>');
document.write('<a href="mailto:email@email.com" class="bluem">Click Here to Register</a></p>');
document.write('</div>');
document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');
document.write('<div id="upcoming-events" align="right">');
document.write('<h3>Search</h3>');

document.write('<input name="searchbox" type="text" id="searchbox" size="" maxlength="20"  class="searchfield"/>');	
document.write('<img src="images/search.jpg" alt="search" name="search" width="78" height="31" id="search" onmouseover="MM_swapImage(\'search\',\'\',\'images/search-over.jpg\',1)" onmouseout="MM_swapImgRestore()" />');	
document.write('</div>');
}



if (pageName == 'client'){
document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');
document.write('<div id="upcoming-events" align="right">');
document.write('<h3>IGP Account Manager<br>Contact Info</h3>');
document.write('<p><strong>Firstname Lastname</strong><br>');
document.write('(000) 000-0000<br>');
document.write('<a href="mailto:email@email.com" class="bluem">email@igpinfo.com</a></p>');

document.write('<p><strong>Firstname Lastname</strong><br>');
document.write('(000) 000-0000<br>');
document.write('<a href="mailto:email@email.com" class="bluem">email@igpinfo.com</a></p>');
document.write('</div>');
}


if (pageName == 'networkpartner'){
document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');
document.write('<div id="upcoming-events" align="right">');
document.write('<h3><em>Network Partners&#39;</em><br><em>Network News</em></h3>');
document.write('<p>Newsletter published exclusively for IGP Network Partners.<br>');
document.write('<a href="#" class="bluem">Learn More</a></p>');
document.write('</div>');
}


if (pageName == 'careers'){
			document.getElementById('careerspic').src = "images/navigation/careers-over.gif";
}
if (pageName == 'seminars'){
			document.getElementById('seminarspic').src = "images/navigation/seminars-events-over.gif";
}
if (pageName == 'contact'){
			document.getElementById('contactpic').src = "images/navigation/contact-over.gif";
}

document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');

document.write('<div id="upcoming-events" align="right">');
document.write('<input name="searchbox" type="text" id="searchbox" size="" maxlength="20"  class="searchfield"/>');	
document.write('<img src="/igpinfo/images/search.jpg" alt="search" name="search" width="78" height="31" id="search" onmouseover="MM_swapImage(\'search\',\'\',\'/igpinfo/images/search-over.jpg\',1)" onmouseout="MM_swapImgRestore()" />');	
document.write('</div>');

document.write('</ul>');

document.write('</div>');



	document.getElementById(pageName).style.color = "#053855";	
}




// SUB NAVIGATION

function div(divIndex){
	document.getElementById('content').innerHTML = document.getElementById('content'+divIndex).innerHTML; 
}

function div1(){
	document.getElementById('content').innerHTML = document.getElementById('content1').innerHTML; 
	}

function div2(){
	document.getElementById('content').innerHTML = document.getElementById('content2').innerHTML; 		
}

function div3(){
	document.getElementById('content').innerHTML = document.getElementById('content3').innerHTML; 
	}

function div4(){
	document.getElementById('content').innerHTML = document.getElementById('content4').innerHTML; 
	}

function div5(){
	document.getElementById('content').innerHTML = document.getElementById('content5').innerHTML; 
	}

function div6(){
	document.getElementById('content').innerHTML = document.getElementById('content6').innerHTML; 
	}

function div7(){
	document.getElementById('content').innerHTML = document.getElementById('content7').innerHTML; 
	}

function div8(){
	document.getElementById('content').innerHTML = document.getElementById('content8').innerHTML; 
	}

function showDiv(){
	//load the appropriate div for viewing
	if('content' in pageURLArgs){
		div(pageURLArgs['content']);
	}else{
		div(1);
	}
}

function loadPageArgs(){	
	
	//check if args were passed via URL
	if(window.location.href.split("?").length < 2)
		return;
	
	//Args were passed: retieve array or name,val pais e.g. {content=1,id=5,...}
	var argNameValPairs = window.location.href.split("?")[1].split("&");
	
	//load pageURLArgs map
	for(var i = 0; i < argNameValPairs.length; i++){
		nameValPair = argNameValPairs[i].split("=");
		pageURLArgs[nameValPair[0]] = nameValPair[1];
	}
}

loadPageArgs();




