function popup_win( loc, wd, hg ) {
   var remote = null;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = screen.availHeight/2 - hg/2; 
   remote = window.open('','','width=' + wd + ',height=' + hg + ',resizable=1,scrollbars=1,screenX=0,screenY=0,top='+ypos+',left='+xpos);
   if (remote != null) {
      if (remote.opener == null) {
         remote.opener = self;
      }
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function popup_win2( loc, wd, hg ) {
   var remote = null;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = screen.availHeight/2 - hg/2; 
   remote = window.open('','','width=' + wd + ',height=' + hg + ',resizable=1,scrollbars=1,toolbar=1,menubar=1,screenX=0,screenY=0,top='+ypos+',left='+xpos);
   if (remote != null) {
      if (remote.opener == null) {
         remote.opener = self;
      }
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function popup_win3( loc ) {
   var remote = null;
   var wd = 680;
   var hg = screen.availHeight * 0.8;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = (screen.availHeight/2 - hg/2) - 64; 
   remote = window.open(loc, "newwindow", "toolbar=1,menubar=0,scrollbars=1,resizable=1,location=top,status=0,width="+wd+",height="+hg+",screenX=0,screenY=0,top="+ypos+",left="+xpos);
   if (remote != null) {
      if (remote.opener == null) {
         remote.opener = self;
      }
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function popup_win4( loc, wd, hg ) {
   var remote = null;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = screen.availHeight/2 - hg/2; 
   remote = window.open('','','width=' + wd + ',height=' + hg + ',resizable=1,toolbar=1,scrollbars=1,screenX=0,screenY=0,top='+ypos+',left='+xpos);
   if (remote != null) {
      if (remote.opener == null) {
         remote.opener = self;
      }
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function popup_win5( loc, wd, hg ) {
   var remote = null;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = screen.availHeight/2 - hg/2; 
   remote = window.open(loc,"newwindow",'width=' + wd + ',height=' + hg + ',resizable=0,toolbar=0,scrollbars=1,screenX=0,screenY=0,top='+ypos+',left='+xpos);
   if (remote != null) {
      if (remote.opener == null) {
         remote.opener = self;
      }
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function popup_win6( loc, wn ) {
  var remote = null;
   var wd = 680;
   var hg = screen.availHeight * 0.8;
   var xpos = screen.availWidth/2 - wd/2; 
   var ypos = (screen.availHeight/2 - hg/2) - 64; 
   
   remote = window.open(loc, wn, "toolbar=1,menubar=0,scrollbars=1,resizable=1,location=top,status=0,width="+wd+",height="+hg+",screenX=0,screenY=0,top="+ypos+",left="+xpos);
   if (remote != null) {
      remote.location.href = loc;
      remote.focus();
   } 
   else { 
      self.close(); 
   }
}

function open_url(url, x) {
   if ((x==1) && (window.opener!=null)) {
      window.self.close();
      window.opener.focus();
      window.opener.location.href = url;
   }
   else {
      var w = window.open(url, '_new');
      w.focus();
      w.opener = self;
   }
}

function open_url2(url) {
	if (window.opener==null) {
		window.location.href = url
	}
	else {
      var w = window.open(url, '_new');
      w.focus();
      w.opener = self;
      window.self.close();
	}
}

//popup window with popup blocker check
function popup_win7( loc, wd, hg, msg) {
    var remote = null;
    var xpos = screen.availWidth/2 - wd/2; 
    var ypos = screen.availHeight/2 - hg/2; 
    remote = window.open(loc,'','width=' + wd + ',height=' + hg + ',resizable=0,scrollbars=1,screenX=0,screenY=0,top='+ypos+',left='+xpos);
	try{
		remote.focus();
	} 
	catch(e){ 
		//alert('The page you clicked could not be opened!\nDo you have any pop-up blocker installed?\n\nIf so, please disable the pop-up blocker or \nadd this site to the "allow pop-up" list.');
		alert(msg);
	}
}

//hide/show div section
//element id to hide/show, action, image id to change, imgExpand, imgCollapse
function toggleDiv(id, newClass, imgId, imgE, imgC) 
{ 
	var identity=document.getElementById(id); 
	if (identity.className == "toggleshow") {
		identity.className="toggle";
		if (imgId != null && imgId != "")
			document.images[imgId].src = imgE;		
	}
	else{
		identity.className= newClass;
		if (imgId != null && imgId != "") 
			document.images[imgId].src = imgC;		
	}
}
var sessionTimeoutAlert = function(intMinutes, intOffset, msg) {
	if (!isNaN(intMinutes) && intMinutes > intOffset){ 
		intMinutes = (intMinutes - intOffset) * 60 * 1000;
		//var strMsg = "WARNING: To ensure security of your resume, this session will expire in " + intOffset + " minutes. If you have made changes on this page, please save them NOW. Otherwise, the changes will be lost. You can continue to update after you have saved the changes.";	
		var strMsg = msg.replace("#intOffset#", intOffset);
		setTimeout("alert('" + strMsg + "')",intMinutes);
	}
}

function toggleDiv2(showHideDiv) {
	var ele = document.getElementById(showHideDiv);
	if(ele.style.display == "block") {
		ele.style.display = "none";
	}
	else {
		ele.style.display = "block";
	}
}


function toggleDiv3(showHideDiv, divName) {
	var newboxes = document.getElementsByTagName("div");
            for(var x=0; x<newboxes.length; x++) {
                  name = newboxes[x].getAttribute("name");
                  if (name == divName) {
                  	if (newboxes[x].id == showHideDiv) {
						if(newboxes[x].style.display == "block") {
							newboxes[x].style.display = "none";
						} else {
							newboxes[x].style.display = "block";
						}
                    	
                  	} else {
						if(newboxes[x].style.display == "block") {
							newboxes[x].style.display = "none";
						} else {
							newboxes[x].style.display = "none";
						}
                  	}
            }
      }
}
