//************************************************************************************
// SHOW / HIDE LAYERS
//************************************************************************************
function showHtmlSection(newPage)
{
	showHideLayers('htmlDiv','','show');
	resizeFlash('wizard', 200);
	window.frames.theFrame.location.href = newPage;
}
function hideHtmlSection()
{
	showHideLayers('htmlDiv','','hide');
	resizeFlash('wizard', 756, 800);
	window.frames.theFrame.location.href = "";
}
function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


//************************************************************************************
// RESIZE FLASH OBJECT
//************************************************************************************
function resizeFlash(flashID, newWidth, newHeight)
{
	//alert("RESIZING: " + newHeight);
	//if(navigator.appName.indexOf("Microsoft") != -1){var obj = document.getElementById(flashID);}
	//else{var obj = document.getElementById(flashID + '2');}
 	if(document.getElementById(flashID) != undefined){
 		var obj = document.getElementById(flashID); 
 	}
 	else{
 		var obj = document.getElementById(flashID + '2'); 
 	}
 	
 	if(newWidth != undefined){obj.width = newWidth;}
 	if(newHeight != undefined){obj.height = newHeight;}
 	if(window.parent.document.getElementById('gridFrame') != undefined){window.parent.resizeFrame(newHeight + 40);}
}

function certmailMessage()
{
var tempStr = "/apps/inProductUpgrades/DomainControl.aspx";
var tempStr2 = "CertMail is not available for XSellerate that doesn't have a domain registered or associated with it yet.\nClick 'OK' to register and manage your domains.";
if(window.confirm(tempStr2))
	{
		window.open(tempStr,'DomainManager',500,400);
	}
}

//************************************************************************************
// GET BROWSER SCROLL POSITION
//************************************************************************************
function getPos()
{
 	if(document.getElementById('wizard') != undefined){
 		document.getElementById('wizard').setVariable("scrollPosition", document.body.scrollTop + 100);
 	}	
}


//************************************************************************************
// DETECT ACROBAT PLAYER AND VERSION
//************************************************************************************
function detectAcrobat()
{
	/*******************************************************
	ACROBAT DETECT
	All code by Ryan Parman, unless otherwise noted.
	(c) 1997-2003, Ryan Parman
	http://www.skyzyx.com
	Distributed according to SkyGPL 2.1, http://www.skyzyx.com/license/
	*******************************************************/

	var acrobat=new Object();

	// Set some base values
	acrobat.installed=false;
	acrobat.version='0.0';

	if (navigator.plugins && navigator.plugins.length)
	{
		for (x=0; x<navigator.plugins.length; x++)
		{
			if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1)
			{
				acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);

				if (acrobat.version.toString().length == 1) acrobat.version+='.0';
				
				wizard.SetVariable("AcrobatVersion", acrobat.version);
				acrobat.installed=true;
				break;
			}
		}
	}
	else if (window.ActiveXObject)
	{
		for (x=2; x<10; x++)
		{
			try
			{
				oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
				if (oAcro)
				{
					acrobat.installed=true;
					acrobat.version=x+'.0';
					
					wizard.SetVariable("AcrobatVersion", acrobat.version);
				}
			}
			catch(e) {}
		}

		try
		{
			oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
			if (oAcro4)
			{
				acrobat.installed=true;
				acrobat.version='4.0';
				
				wizard.SetVariable("AcrobatVersion", acrobat.version);
			}
		}
		catch(e) {}
	}

	acrobat.ver4=(acrobat.installed && parseInt(acrobat.version) >= 4) ? true:false;
	acrobat.ver5=(acrobat.installed && parseInt(acrobat.version) >= 5) ? true:false;
	acrobat.ver6=(acrobat.installed && parseInt(acrobat.version) >= 6) ? true:false;
	acrobat.ver7=(acrobat.installed && parseInt(acrobat.version) >= 7) ? true:false;
	acrobat.ver8=(acrobat.installed && parseInt(acrobat.version) >= 8) ? true:false;
	acrobat.ver9=(acrobat.installed && parseInt(acrobat.version) >= 9) ? true:false; 
}