
if (document.images){
	status_open = new Image();status_close = new Image();
	status_open.src = "https://imagesak.securepaynet.net/aaa/sb/bul_open.gif";status_close.src = "https://imagesak.securepaynet.net/aaa/sb/bul_close.gif";}
	
function gosb(url,t){
	if(t == "")t="_self";window.open(url,t);}

function sbStatus(){
	var dpClosed = false;
	var item = new Array("qs","mc","ma","s","e","rp","b","cr","mr","mn","rg"); //sidebar open/close
	for(x=0;x<item.length;x++){
		if(getCookie('sidebar_' + item[x]) == "1"){
			if(document.images [item[x]+"_img"]) document.images [item[x]+"_img"].src = status_close.src;
			if(document.getElementById(item[x]+'_div')) document.getElementById(item[x]+'_div').style.display = "";
			if((item[x]=="rp")||(item[x]=="s")) dpClosed = true;}
	}

	var item = new Array("customize","test");//landing page open/close
	for(x=0;x<item.length;x++){
		if(getCookie('sidebar_' + item[x]) == "1"){
			if (document.images [item[x]+"_img"]){
				document.images [item[x]+"_img"].src = status_open.src;document.getElementById(item[x]+'_div').style.display = "none";}
}}}

function checkHome(item)
{
	//homepage sidebar hasn't been activated yet, reload	
	var url = "https://www.securepaynet.net/gdshop/default.asp?prog%5Fid=426535&app%5Fhdr=&sb=1&item=sbitem";
	url = url.replace('sbitem', item);window.open(url,'_self');}

function togSB(item){
	if(document.images [item+"_img"])	document.images [item+"_img"].src = (document.images [item+"_img"].src == status_open.src) ? status_close.src:status_open.src;
	if(document.getElementById(item+'_div')) document.getElementById(item+'_div').style.display = (document.getElementById(item+'_div').style.display=="none") ? "":"none";
	if(getCookie('sidebar_' + item) == "1"){
		eraseCookie('sidebar_' + item);
		if((document.getElementById('dp_divB'))&&(getCookie('sidebar_rp') != "1")&&(getCookie('sidebar_s') != "1")) document.getElementById('dp_divB').style.display = "";		
	}
	else{
		createCookie('sidebar_' + item,1,'');
		if((document.getElementById('dp_divB'))&&((getCookie('sidebar_rp') == "1")||(getCookie('sidebar_s') == "1"))) document.getElementById('dp_divB').style.display = "none";		
}}

function linkSB(url){
	location.href = url;}

function createCookie(name,value,days){
	if (days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
	return null;
}

function eraseCookie(name){
	createCookie(name,"",-1);}

function editSBselected(theForm, theVal, theDomain){
	if (theVal){
		theForm.searchSBselected.value = theForm.searchSBselected.value + '|' + theDomain + '|'}
	else{
		var theStr = theForm.searchSBselected.value;theStr = theStr.replace('|' + theDomain + '|', '');theForm.searchSBselected.value = theStr
}}

function checkSBDomain(searchForm){
	var canSubmit = false;
	var searchValue;
	if ('' == '' && searchForm.domainToCheck){
		searchValue = searchForm.domainToCheck.value;
		if (searchValue != ''){
			var regExInvalidChars = /[^a-zA-Z0-9-\s.]+/;
			if (regExInvalidChars.test(searchValue)){
				alert('Invalid character in domain.\n\nOnly letters, numbers or hyphens are allowed.')}
			else{
			canSubmit = true;}
		}
	}
	if (canSubmit){
		return true;
	}
	else{
		return false;}
}



function enterkey(frm,e){
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if (keycode == 13) frm.submit();
}

function popPage(pagename, cici, progid, apphdr){
	var pgurl = 'prog%5Fid=426535&app%5Fhdr=0&ci=cici';
	pgurl = pgurl.replace('cici', cici);
	if (progid != '') pgurl = pgurl.replace('426535', progid);
	if (apphdr != '') pgurl = pgurl.replace('hdr=0', 'hdr=' + apphdr);
	if (pagename.indexOf('?') <= 0){
		pgurl = '?' + pgurl}
	else{
		pgurl = '&' + pgurl}
	if ((pagename.indexOf('http://') < 0)&&(pagename.indexOf('https://') < 0)){
		pgurl = ('https://www.securepaynet.net/gdshop/' + pagename + pgurl);}
	else{
		pgurl = (pagename + pgurl);	}
	var win=window.open(pgurl, 'spop', 'left=20,top=20,resizable=yes,scrollbars=yes,width=610,height=620');
}
function popPage2(pagename, cici, progid, apphdr,w,h){
	var pgurl = 'prog%5Fid=426535&app%5Fhdr=0&ci=cici';
	pgurl = pgurl.replace('cici', cici);
	if (progid != '') pgurl = pgurl.replace('426535', progid);
	if (apphdr != '') pgurl = pgurl.replace('hdr=0', 'hdr=' + apphdr);
	if (pagename.indexOf('?') <= 0){
		pgurl = '?' + pgurl}
	else{
		pgurl = '&' + pgurl}
	if ((pagename.indexOf('http://') < 0)&&(pagename.indexOf('https://') < 0)){
		pgurl = ('https://www.securepaynet.net/gdshop/' + pagename + pgurl);}
	else{
		pgurl = (pagename + pgurl);	}
	var win=window.open(pgurl, 'spop', 'left=20,top=20,resizable=yes,scrollbars=yes,width='+w+',height='+h);
}
function popAnchor(pagename, cici, anchor){
	var pgurl = 'prog%5Fid=426535&app%5Fhdr=0&ci=cici';
	pgurl = pgurl.replace('cici', cici);
	if (pagename.indexOf('?') <= 0){
		pgurl = '?' + pgurl}
	else{
		pgurl = '&' + pgurl}
	if ((pagename.indexOf('http://') < 0)&&(pagename.indexOf('https://') < 0)){
		pgurl = ('https://www.securepaynet.net/gdshop/' + pagename + pgurl);}
	else{
		pgurl = (pagename + pgurl);	}
	if (anchor != '') pgurl = pgurl + '#' + anchor
	var win=window.open(pgurl, 'spop', 'left=20,top=20,resizable=yes,scrollbars=yes,width=610,height=620');
}
function popFaq(article_id){
	var faqurl = 'http://help.securepaynet.net/article.php?prog%5Fid=426535&app%5Fhdr=0&article%5Fid=fff';
	faqurl = faqurl.replace('fff', article_id);
	var win=window.open(faqurl, 'spop', 'left=20,top=20,resizable=yes,scrollbars=yes,width=610,height=620');
}
function popFaqTopic(topic_id){
	var faqurl = 'http://help.securepaynet.net/article_list.php?prog%5Fid=426535&app%5Fhdr=0&topic%5Fid=fff';
	faqurl = faqurl.replace('fff', topic_id);
	var win=window.open(faqurl, 'spop');
}
function popFaqTopic2(topic_id){
	var faqurl = 'http://help.securepaynet.net/topic_list.php?prog%5Fid=426535&app%5Fhdr=0&topic%5Fid=fff';
	faqurl = faqurl.replace('fff', topic_id);
	var win=window.open(faqurl, 'spop');
}
var internal_clicked = false;	 //for abandon popup
function processLinks(){ //set internal_clicked on all links
  var links = document.getElementsByTagName("A");
  for (var i=0; i < links.length; i++){
		if(!links[i].onclick) links[i].onclick = function(){internal_clicked = true;}}
  //set internal_clicked on all form submits
  var forms = document.getElementsByTagName("FORM");
  for (var i=0; i < forms.length; i++){
    if(!forms[i].onsubmit) forms[i].onsubmit = function(){internal_clicked = true;}}
}
function abandonWin(){
	if (!internal_clicked){ //show abandon popup	
		var target = "_abandon";		
		var url = "https://www.securepaynet.net/gdshop/jump_pages/abandon.asp?prog%5Fid=426535&app%5Fhdr=99&location=locationurl";
		var loc = document.location.href; loc += (loc.indexOf('?') > 0) ? "&":"?";
		if (loc.indexOf('domainToCheck') < 1) loc += "domainToCheck=&tld=&checkAvail=&currStep="
		loc = passedURLEncode(loc);
		url = url.replace('locationurl', loc);		
		var winWidth = 420; var winHeight = 370;
		var options = "resizable=0,scrollbars=0,status=0,location=0,menubar=0,toolbar=0,width=" + winWidth + ",height=" + winHeight + ",top=" + ((screen.availHeight - winHeight) /2) + ",left=" + ((screen.availWidth - winWidth) /2) + ",screenX=" + ((screen.availWidth - winWidth) /2) + ",screenY=" + ((screen.availHeight - winHeight) /2) + ",";
		var win = window.open(url,target,options); win.focus();}
}
function passedURLEncode(str)
{
	str = str.replace(/\?/g,"!");str = str.replace(/=/g,"^");str = str.replace(/&/g,"$");
	return str;
}


    var agt=navigator.userAgent.toLowerCase();
    var is_safari = agt.indexOf("safari")!=-1;
    function mainovr(div,name,status){
	    if(is_safari){
		    bHover=name; Act(div,name,false);window.status=status;}
	    else{
		    bHover=name;window.status=status;setTimeout('Act(\'' + div + '\', \'' + name + '\', false)',400);}
    }
    function findDiv(n, d) { 
	    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=findDiv(n,d.layers[i].document);
      if(!x && document.getElementById) x=document.getElementById(n); return x;
    }
    function tNav() { 
	    var i,p,v,obj,args=tNav.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=findDiv(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
        if(v=='visible')setPosition(args[i]);    
        obj.visibility=v;} 
    }
    function hde(sect) {
      tNav('dom','','hide');tNav('host','','hide');tNav('sslhdr','','hide');tNav('em','','hide');tNav('eco','','hide');tNav('webs','','hide');showElement('SELECT');
    }
    function hideDD(sect) {
      tNav(sect,'','hide');hde(sect);
    }
    var secSet = null;
    var activeTimer = null;
    var bHover = '';
    function Act(sect, windowStatusVal, bshow) {
	    hde(sect);
	    if ((bHover==windowStatusVal)||(bshow)){		
		    tNav(sect,'','show');
		    if (secSet != null) window.clearTimeout(secSet);		
		    hideElement('SELECT', document.all[sect]); 
	    }
    }
    function setPosition(sect)
    {
      var obj, objstyle, overobj, len=0;
      //overobj=findDiv(sect+"_td");
      //obj=findDiv(sect);  
      overobj = document.getElementById(sect+'_td');
      obj = document.getElementById(sect);
      if (eval(overobj.offsetLeft+obj.offsetWidth) > overobj.offsetParent.offsetWidth) len = eval(overobj.offsetLeft+obj.offsetWidth)-overobj.offsetParent.offsetWidth;
      obj.style.left = eval(overobj.offsetLeft-len) +'px';
    }
    function Tim(sect){
	    if (secSet != null) window.clearTimeout(secSet);
	    secSet = window.setTimeout('hideDD("' + sect + '")',500);
    }

    function hideElement( elmID, overDiv ) {
      if(document.all) {
        for(i = 0; i < document.all.tags( elmID ).length; i++) {
          obj = document.all.tags( elmID )[i];
          if(!obj || !obj.offsetParent) continue;
          // Find the element's offsetTop and offsetLeft relative to the BODY tag.
          objLeft   = obj.offsetLeft - overDiv.offsetParent.offsetLeft;
          objTop    = obj.offsetTop;
          objParent = obj.offsetParent;
          while(objParent.tagName.toUpperCase() != 'BODY') {
            objLeft  += objParent.offsetLeft;
            objTop   += objParent.offsetTop;
            objParent = objParent.offsetParent;}
          objHeight = obj.offsetHeight;
          objWidth  = obj.offsetWidth;            
          if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
          else if((overDiv.offsetParent.offsetTop + overDiv.offsetHeight + 50) <= objTop);
          else if(overDiv.offsetTop >= eval(objTop + objHeight));
          else if(overDiv.offsetLeft >= eval(objLeft + objWidth));
          else {
            obj.style.visibility = 'hidden';
          }
        }
      }
    }

    function showElement(elmID) {
      if(document.all) {
        for(i = 0; i < document.all.tags( elmID ).length; i++) {
          obj = document.all.tags(elmID)[i];
          if(!obj || !obj.offsetParent) continue;
          obj.style.visibility = '';
        }
      }
    }
