var ToolBar_Supported = true;
var PageResized = false;

if (ToolBar_Supported)
{
	var DivCreateStr;
	var PageHeadMinWidth	= 760;
	
	var ixLangTitleSel	= 1;
	var ixContTitleSel	= 1;
	var contTitle		= new Array(5);
	var contTitleWid	= new Array(5);
	var contTitleLink	= new Array(5);

	var ixNaviSel		= 0;
	var RootNaviPath	= "../";
	var NaviList		= new Array(13);
	var NaviListLink	= new Array(13);
	
	var subTitle		= "";
	var bolExplorer		= true;
	if(navigator.appName!="Microsoft Internet Explorer"){
		bolExplorer		= false;
		// Define event handlers
		window.onresize  = ResizePageHead;
		window.onscroll = ScrollPage;
	}	
}

function CreatePageHead()
{
	if(bolExplorer)
		DivCreateStr = "<table id='idPage' border='0' width='100%' cellspacing='0' cellpadding='0' height='100%'><tr><td vAlign='top'>";
	else
		DivCreateStr = "";
		
	DivCreateStr += "<table id='idPageHead' height='59' cellSpacing='0' cellPadding='0' width='100%' border='0' style='border-collapse: collapse' bordercolor='#111111'>";
	DivCreateStr += "<tr>";
	DivCreateStr += "<td vAlign='top' noWrap align='left' width='59' height='59'>";
	DivCreateStr += "<p style='text-indent: 0; margin: 0'>";
	DivCreateStr += "<a href='.'>";
	DivCreateStr += "<img alt='Abrosoft CMP Home - Custom Morph Photo Service' src='images/headicon.gif' border='0' width='59' height='59'></a></td>";
	DivCreateStr += "<td vAlign='top' align='left' background='../images/headback.gif' height='59'>";
	DivCreateStr += "<p style='text-indent: 0; margin: 0' align='left'>";
	DivCreateStr += "<a href='.'>";
	DivCreateStr += "<img border='0' src='images/headcmp.gif' alt='Abrosoft CMP Home - Custom Morph Photo Service' width='159' height='59'></a></td>";
	DivCreateStr += "<td vAlign='top' align='left' width='119' height='59'>";
	DivCreateStr += "<a href='..'>";
	DivCreateStr += "<img alt='Abrosoft FantaMorph home' src='../images/headcorp.gif' border='0' width='119' height='59'></a></td>";
  	DivCreateStr += "</tr>";
	DivCreateStr += "</table>";
	document.write(DivCreateStr);

	contTitle[0] = "home";
	contTitle[1] = "serv";
	contTitle[2] = "buy";
	contTitle[3] = "supp";
	contTitle[4] = "forum";

	contTitleWid[0] = "52";
	contTitleWid[1] = "54";
	contTitleWid[2] = "65";
	contTitleWid[3] = "58";
	contTitleWid[4] = "53";

	contTitleLink[0] = ".";
	contTitleLink[1] = "overview.htm";
	contTitleLink[2] = "purchase.htm";
	contTitleLink[3] = "contact.htm";
	contTitleLink[4] = "../forum";

	DivCreateStr = "<TABLE id='idPageTitle' cellSpacing=0 cellPadding=0 width='100%' border=0><TR>";
	
   	DivCreateStr += "<td class='ToolLink' noWrap background='../images/toolback.gif' width='150' height='21'></td>";


	for (i = 1; i < 6; i++) 
	{
		DivCreateStr += "<TD noWrap width='" + contTitleWid[i-1] +"' height='21'><a href='" + contTitleLink[i-1] + "'><img border='0' src='../images/tb" + contTitle[i-1];
		if (ixContTitleSel == i)
		{
			DivCreateStr += "1.gif'";
		}
		else
		{
			DivCreateStr += ".gif'";
		}
		DivCreateStr += " width='" + contTitleWid[i-1] + "' height='21'></a></td>";
	}

	DivCreateStr += "<td class='TBRight'>&nbsp;</td></TR></TABLE>";

	document.write(DivCreateStr);
	DrawDecorateBorder();
	CreateNavibar();
}

function DrawDecorateBorder()
{
	DivCreateStr = "<DIV ID='idDecorateBorder' class='DecorateBorder' STYLE='position:relative;width:100%;height:8;background-image: url(../images/left-navi.gif);' nowrap>";
	DivCreateStr += "<IMG SRC='../images/left-top.gif' BORDER=0>";
	DivCreateStr += "<IMG SRC='../images/navi-shadow.gif' BORDER=0>";
	DivCreateStr += "</DIV>";

	document.write(DivCreateStr);
}

function CreateNavibar()
{
	NaviList[0]		= "Overview";
	NaviListLink[0]	= "overview.htm";

	NaviList[1]		= "What's New";
	NaviListLink[1]	= "whatsnew.htm";

	NaviList[2]		= "Features";
	NaviListLink[2]	= "features.htm";

	NaviList[3]		= "Samples - Morph";
	NaviListLink[3]	= "samplemorph.htm";

	NaviList[4]		= "Samples - Flip";
	NaviListLink[4]	= "sampleflip.htm";

	NaviList[5]		= "Photo Requirements";
	NaviListLink[5]	= "requirements.htm";

	NaviList[6]		= "FAQs";
	NaviListLink[6]	= "faq.htm";

	NaviList[7]	= "Submit a Question";
	NaviListLink[7]= "submit.htm";

	NaviList[8]	= "Contact Us";
	NaviListLink[8]= "contact.htm";

	NaviList[9]		= "Order Process";
	NaviListLink[9]	= "process.htm";

	NaviList[10]	= "Price List";
	NaviListLink[10]= "price.htm";

	NaviList[11]	= "Order Now";
	NaviListLink[11]= "purchase.htm";

	NaviList[12]	= "Win a Free Pack!";
	NaviListLink[12]= "free.htm";

	DivCreateStr = "<table id='idNavi' border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' height='100%' id='AutoNumber1'>";
  	DivCreateStr += "<tr>";
	DivCreateStr += "<td vAlign='top' width='150' background='../images/left-back.gif' height='100%' rowSpan='2' nowrap>";
	DivCreateStr += "<img height='6' src='../images/blank-trans.gif' width='5' border='0'> </td>";
	DivCreateStr += "<td width='5' height='100%' background='../images/left-shadow.gif' bgColor='#ffffff' rowSpan='2'>";
	DivCreateStr += "<img height='6' src='../images/blank-trans.gif' width='5' border='0'></td>";
	DivCreateStr += "<td valign='top'>";
	if ((ixNaviSel != 13 &&ixNaviSel != 0) || subTitle!= "") // && ixNaviSel != 16
	{
    	DivCreateStr += "<br><br>";
    	DivCreateStr += "<hr color='#cccccc' noShade SIZE='1'>";
	}
	DivCreateStr += "<DIV ID='idNavibar' STYLE='position:absolute;left:0;top:86;width:150;' nowrap>";

	for (i = 1; i < 14; i++)
	{
		if (i==1) DivCreateStr += "<DIV class='NaviTitle'><img src='../images/left-service.gif' border='0' width='125' height='21'></DIV>";
		if (i == 6) DivCreateStr += "<DIV class='NaviTitle'><img src='../images/left-support.gif' border='0' width='125' height='21'></DIV>";
		if (i == 10) DivCreateStr += "<DIV class='NaviTitle'><img src='../images/left-purchase.gif' border='0' width='125' height='21'></DIV>";


		if (ixNaviSel != i)
		{
			DivCreateStr += "<DIV class='NaviItem' nowrap>";
			DivCreateStr += "<img height='10' src='../images/blank-trans.gif' width='15' align='middle'>";
		}
		else if (ixNaviSel == i)
		{
			DivCreateStr += "<DIV class='NaviItemSel' nowrap>";
			DivCreateStr += "<img height='10' src='../images/blank-trans.gif' width='15' align='middle'>";

			if (ixNaviSel != 13) // && ixNaviSel != 12
			{
				Divs =  "<DIV class='Title'  STYLE='position:absolute;left:160;top:90;' nowrap>" + subTitle;
				if (subTitle =="") Divs += NaviList[i-1];
				Divs += "</DIV>";
				document.write(Divs);
			}
		}

		if (ixNaviSel != i)
		{
			DivCreateStr += "<A class='leftLink' href='";
			DivCreateStr += NaviListLink[i-1] + "'>";
		}

		DivCreateStr += NaviList[i-1];
		if (ixNaviSel != i) DivCreateStr += "</A>";
		DivCreateStr += "</DIV>";
	}

	if (ixNaviSel == 0 && subTitle != "") // && ixNaviSel != 16
	{
		Divs =  "<DIV class='Title'  STYLE='position:absolute;left:160;top:90;' nowrap>" + subTitle;
		if (subTitle =="") Divs += NaviList[i-1];
		Divs += "</DIV>";
		document.write(Divs);
	}

	DivCreateStr += "</DIV>";
	document.write(DivCreateStr);
}

function CreatePageEnd()
{
	if(bolExplorer)
	{
		DivCreateStr = "</td>";
	  	DivCreateStr += "</tr>";
		DivCreateStr += "</table>";
	}

	DivCreateStr = "</td>";
  	DivCreateStr += "</tr>";
	DivCreateStr += "</table>";
	document.write(DivCreateStr);
}

function ResizePageHead()
{
	w = Math.max(PageHeadMinWidth, idNavi.offsetWidth);
	idPageHead.style.width = w;
	idDecorateBorder.style.width = w;
	idPageTitle.style.width = w;
	PageResized = true;
}

function ScrollPage()
{
	if (!PageResized) ResizePageHead();
} 

function ShowVideo(n)
{
	var w;
	w = window.open('video'+n+'.htm','','resizable=1,width=530,height=430');
	w.focus();
}

function ShowDetails(n)
{
	var w;
	w = window.open('frame'+n+'.htm','','width=640,height=500,scrollbar=yes,resizable=yes,location=no,status=no');
	w.focus();
}

function OpenWin(e)
{
	window.open(e, "", "height=600, width=840, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
}

function ShowStep(e){
	var i, stepname="";
	for (i=1; i<5; i++) { 
	   stepname="step"+i;
		element=document.getElementById(stepname).style;
	    element.display=i==e?"":"none";
	   }
}

function AddtoCart(prodid)
{
	var DivCreateStr;
	DivCreateStr  = "<p style='margin-top: 0pt; margin-bottom: 0pt'><form method='post' action='http://www.fantamorph.com/store/cart.php'><input type='hidden' name='action' value='add'>";
	DivCreateStr += "<input type='hidden' name='product_id' value='" + prodid + "'>";
	DivCreateStr += "<input type='hidden' name='variation_id' class='CartVariationId' value=''><input type='hidden' name='currency_id' value=''>";
	DivCreateStr += "<p class='AddCartButton' align='center'><input type='image' src='../images/btn_cart_SM.gif' alt=''></p></form></p>";
	document.write(DivCreateStr);
}
