﻿function externalLinks() { 
	if (!document.getElementsByTagName) return; 
 	var anchors = document.getElementsByTagName("a"); 
 	for (var i=0; i<anchors.length; i++) { 
   		var anchor = anchors[i]; 
   		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
     			anchor.target = "_blank"; 
	 } 
} 
window.onload = externalLinks;

function ShowEmail(user, domain, anchor) {
	var OutText = '';
	OutText += '<a href="mailto:' + user + '@' + domain + '">';
	if (anchor != '') OutText += anchor;
	else OutText += user + '@' + domain;
	OutText  += '</a>';
	document.write(OutText);
}

function openterms() {
    window.open("consumer_terms_and_conditions.html","terms_window","menubar=1,resizable=1,scrollbars=1,width=800,height=600");
}

function openprivacy() {
    window.open("privacy_policy.html","privacy_window","menubar=1,resizable=1,scrollbars=1,width=800,height=600");
}

function openrefund() {
    window.open("refund_policy.html","refunds_window","menubar=1,resizable=1,scrollbars=1,width=600,height=300");
}

function doHidePopUp(selectedDiv) {
	popdiv=document.getElementById(selectedDiv)
	popdiv.style.visibility="hidden"
}
	
function doShowPopUp(){
	popdiv=document.getElementById("divpopup")
	popdiv.style.left="50%"
	popdiv.style.marginLeft="-223px"
	if ((is_ie5up) && (is_mac)){ //fix for ie-mac does not accept popdiv.style.top="50%"
		popdiv.style.top="0px"
		popdiv.style.marginTop="0px"
	}else{
		popdiv.style.top="50%"
		popdiv.style.marginTop="-132px"
	}
	popdiv.style.visibility="visible"
}



function doHidePngPopUp(selectedDiv) {
	popdiv=document.getElementById(selectedDiv)
	popdiv.style.visibility="hidden"
}

	

//--------------SHOW/HIDE LAYERS----------------//
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}



