function Is() {
    var agent   = navigator.userAgent.toLowerCase();
    this.major  = parseInt(navigator.appVersion);
    this.minor  = parseFloat(navigator.appVersion);
    this.ns     = ((agent.indexOf('mozilla')   != -1) &&
                  (agent.indexOf('spoofer')    == -1) &&
                  (agent.indexOf('compatible') == -1) &&
                  (agent.indexOf('opera')      == -1) &&
                  (agent.indexOf('webtv')      == -1));
    this.ns2    = (this.ns && (this.major      ==  2));
    this.ns3    = (this.ns && (this.major      ==  3));
    this.ns4    = (this.ns && (this.major      ==  4));
    this.ns6    = (this.ns && (this.major      >=  5));
    this.ie     = (agent.indexOf("msie")       != -1);
    this.ie3    = (this.ie && (this.major      <   4));
    this.ie4    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   == -1));
    this.ie5    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   != -1));
    this.ieX    = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1


function findWindowSize(whichway){
	    if(ns6) {
	        available_width=window.innerWidth;
	        available_height=window.innerHeight;
	    } else if(ie4) {
	        available_width=document.body.clientWidth;
	        available_height=document.body.clientHeight;
	    }
	if(whichway=="height") return available_height;
	else if(whichway=="width") return available_width;
}

function loadP(pageURL){
top.document.getElementById("product").src=pageURL;
}

function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus
document.onclick=hidestatus
document.onmousedown=hidestatus
document.onmouseup=hidestatus



/***************************
* Open Close Menus
****************************/

function openCloseMenu(){
sh3(document.getElementById("masterdiv"))
sh3(document.getElementById("togglemenu"))
}

function zoomImage2(inout,itemID){
itemName=document.getElementById(itemID)
itemName.style.zoom=inout;
}

function zoomImage3(picID,picHeight){
   		picName = document.getElementById(picID);
		picName.style.zoom = picHeight/picName.height;
}

function zoomImage(picID,picHeight){
   		picName = document.getElementById(picID)
		return image_width = (picName.width/picName.height*picHeight);
} 


/************************
Context Menus
*************************/

var isie=0;
if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) {
isie=1;
}
else {
isie=0;
}

if(isie){
oPopup = window.createPopup()
}

function getFromTitle(){
if(isie) {

var docTitle = document.title;

var picZoom2Html="";
picZoom2Html+='<TR><TD class="context" ID="i8" ONMOUSEOVER="document.all.i8.className=\'conmover\';" ONMOUSEOUT="document.all.i8.className=\'conmout\';" ONCLICK="if(window.parent.document.getElementById(\'item01img\').style.zoom!=0) window.parent.document.getElementById(\'item01img\').style.zoom*=1.6; else window.parent.document.getElementById(\'item01img\').style.zoom=1.6;">&nbsp;<IMG SRC="../mag_plus.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Zoom In</TD></TR>';
picZoom2Html+='<TR><TD class="context" ID="i9" ONMOUSEOVER="document.all.i9.className=\'conmover\';" ONMOUSEOUT="document.all.i9.className=\'conmout\';" ONCLICK="if(window.parent.document.getElementById(\'item01img\').style.zoom!=0) window.parent.document.getElementById(\'item01img\').style.zoom*=0.625; else window.parent.document.getElementById(\'item01img\').style.zoom=0.625;">&nbsp;<IMG SRC="../mag_minus.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Zoom Out</TD></TR>';

var pixelHtml="";
pixelHtml+='<TR><TD class="context"><IMG SRC="pixel.gif" WIDTH="90" HEIGHT="1"></TD></TR>';

var pixel2Html="";
pixel2Html+='<TR><TD class="context"><IMG SRC="../pixel.gif" WIDTH="90" HEIGHT="1"></TD></TR>';

var nav2Html="";
nav2Html+='<TR><TD class="context" ID="i0" ONMOUSEOVER="document.all.i0.className=\'conmover\';" ONMOUSEOUT="document.all.i0.className=\'conmout\';" ONCLICK="window.parent.history.go(-1);">&nbsp;<IMG SRC="../menuback.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Back</TD></TR>';
nav2Html+='<TR><TD class="context" ID="i1" ONMOUSEOVER="document.all.i1.className=\'conmover\';" ONMOUSEOUT="document.all.i1.className=\'conmout\';" ONCLICK="window.parent.history.go(1);">&nbsp;<IMG SRC="../menuforward.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Forward</TD></TR>';
nav2Html+='<TR><TD class="context" ID="i7" ONMOUSEOVER="document.all.i7.className=\'conmover\';" ONMOUSEOUT="document.all.i7.className=\'conmout\';"ONCLICK="top.document.getElementById(\'product\').src=top.document.getElementById(\'product\').src;">&nbsp;<IMG SRC="../menurefresh.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Refresh</TD></TR>';

var order2Html="";
order2Html+='<TR><TD class="context" ID="i01" ONMOUSEOVER="document.all.i01.className=\'conmover\';" ONMOUSEOUT="document.all.i01.className=\'conmout\';" onclick="self.blur();window.parent.addOrder();">&nbsp;<IMG SRC="../menuadd.gif" ALIGN="absmiddle">&nbsp;Add to Order</TD></TR>';

var shopHtml="";
shopHtml+='<TR><TD class="context" ID="i02" ONMOUSEOVER="document.all.i02.className=\'conmover\';" ONMOUSEOUT="document.all.i02.className=\'conmout\';" ONCLICK="self.blur();if (top.window.dd && top.dd.elements)top.dd.elements.assistbox.show();top.assistbox.focus();">&nbsp;<IMG SRC="menuassist.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Assistance</TD></TR>';
shopHtml+='<TR><TD class="context" ID="i03" ONMOUSEOVER="document.all.i03.className=\'conmover\';" ONMOUSEOUT="document.all.i03.className=\'conmout\';" ONCLICK="self.blur();top.product.viewCart();">&nbsp;<IMG SRC="menushop.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Shopping Bag</TD></TR>';

var shop2Html="";
shop2Html+='<TR><TD class="context" ID="i02" ONMOUSEOVER="document.all.i02.className=\'conmover\';" ONMOUSEOUT="document.all.i02.className=\'conmout\';" ONCLICK="self.blur();if (top.window.dd && top.dd.elements)top.dd.elements.assistbox.show();top.assistbox.focus();">&nbsp;<IMG SRC="../menuassist.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Assistance</TD></TR>';
shop2Html+='<TR><TD class="context" ID="i03" ONMOUSEOVER="document.all.i03.className=\'conmover\';" ONMOUSEOUT="document.all.i03.className=\'conmout\';" ONCLICK="self.blur();top.product.viewCart();">&nbsp;<IMG SRC="../menushop.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Shopping Bag</TD></TR>';

var utility2Html="";
utility2Html+='<TR><TD class="context" ID="i4" ONMOUSEOVER="document.all.i4.className=\'conmover\';" ONMOUSEOUT="document.all.i4.className=\'conmout\';" ONCLICK="window.parent.external.AddFavorite(\'http://www.mi-xology.com/shop/\',\'shop @ mi-xology.com\');">&nbsp;<IMG SRC="../menufavorite.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Add to Favorites</TD></TR>';
utility2Html+='<TR><TD class="context" ID="i6" ONMOUSEOVER="document.all.i6.className=\'conmover\';" ONMOUSEOUT="document.all.i6.className=\'conmout\';" onmousedown="self.blur();top.masterdiv.focus();top.masterdiv.sForm.sTerm.focus();">&nbsp;<IMG SRC="../menusearch.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Search</TD></TR>';

var startHtml="";
startHtml+='<TABLE STYLE="border:1pt solid #808080" BGCOLOR="#CCCCCC" width="100" height=';
var html="";
html+=' CELLPADDING="0" CELLSPACING="1">';
html+='<ST'+'YLE TYPE="text/css">\n';
html+='a:link {text-decoration:none;font-family:Arial;font-size:8pt;}\n';
html+='a:visited {text-decoration:none;font-family:Arial;font-size:8pt;}\n';
html+='td {font-size:8pt;}\n';
html+='.context {border:1pt solid #CCCCCC;}\n';
html+='.conmover {background:#CFD6E8; border:1pt solid #737B92;cursor:default;}\n';
html+='.conmout {background:#CCCCCC; border:1pt solid #CCCCCC;cursor:default;}\n';
html+='</ST'+'YLE>\n';
html+='<SC'+'RIPT LANGUAGE="JavaScript">\n';
html+='\n<'+'!--\n';
html+='window.onerror=null;\n';
html+='/'+' -'+'->\n';
html+='</'+'SCRIPT>\n';


var endHtml="";
endHtml+='</TABLE>';
endHtml+='<s'+'cript language="JavaScript1.2">';
endHtml+='function doNothing() {a=b};';
endHtml+='function dontclick(e) { if(self.all) { if(event.button==2||event.button==3) { doNothing(); return false;}}}';
endHtml+='if (self.all) self.onmousedown dontclick();';
endHtml+='self.oncontextmenu = function() {doNothing(); return false;};';
endHtml+='</sc'+'ript>';

var menuHtml="";

if (docTitle == "menu"){
numHeight=40;
menuHtml=startHtml+numHeight+html+shopHtml+endHtml;
}
else if (docTitle == "info"){
numHeight=40;
menuHtml=startHtml+numHeight+html+shopHtml+endHtml;
}
else if (docTitle == "recommend"){
numHeight=100;
menuHtml=startHtml+numHeight+html+shop2Html+pixel2Html+nav2Html+endHtml;
}
else if (docTitle == "category"){
numHeight=100;
menuHtml=startHtml+numHeight+html+shop2Html+pixel2Html+nav2Html+endHtml;
}
else if (docTitle == "product"){
if(document.title==top.document.title) {numHeight=60;menuHtml=startHtml+numHeight+html+order2Html+pixel2Html+picZoom2Html+endHtml;}
else{numHeight=200;
menuHtml=startHtml+numHeight+html+order2Html+pixel2Html+picZoom2Html+pixel2Html+shop2Html+pixel2Html+nav2Html+pixel2Html+utility2Html+endHtml;}
}
else if (docTitle == "photo"){
if(document.title==top.document.title) {numHeight=20;menuHtml=startHtml+numHeight+html+order2Html+endHtml;}
else{numHeight=160;
menuHtml=startHtml+numHeight+html+order2Html+pixel2Html+shop2Html+pixel2Html+nav2Html+pixel2Html+utility2Html+endHtml;}
}
else {
numHeight=40;
menuHtml=startHtml+numHeight+html+shopHtml+endHtml;
}

return menuHtml;
}
}

function dopopup(x,y) {
if(isie) {
var oPopupBody = oPopup.document.body;
oPopupBody.innerHTML = getFromTitle();
oPopup.show(x, y, 100, numHeight, document.body);
}
}

function click(e) {
if(isie) {
if(document.all) {
if(event.button==2||event.button==3) {
dopopup(event.x-1,event.y-1);
}
}
}
}

if(isie) {
document.oncontextmenu = function() { dopopup(event.x,event.y); return false;}
document.onmousedown = click;
document.onmouseup = click;
}


/**********************************
Dynamic Pricing
***********************************/

function scan(cc_number)
{
if(cc_number==null)cc_number = "";
testc=0;
new_ccnumber="";
cclen = cc_number.length;
if((cc_number.indexOf("$") != -1) || (cc_number.indexOf("£") != -1) || (cc_number.indexOf("¬") != -1) || (cc_number.indexOf("\u20ac") != -1))
{
startc = cc_number.indexOf("$")+1;
if(startc==0)startc = cc_number.indexOf("£")+1;
if(startc==0)startc = cc_number.indexOf("¬")+1;
for(n=startc;n<cclen;n++)
   {
   tc = cc_number.substring(n,n+1);
   if(tc == "0" || tc == "1" || tc == "2" ||tc == "3" || tc == "4" ||tc == "5" || tc == "6"  || tc == "7" || tc == "8" || tc == "9" || tc == "." )
   new_ccnumber = new_ccnumber + tc;
   else
   n = cclen;
   }
}
if(new_ccnumber == "")new_ccnumber=0;
return new_ccnumber;
}

function totalPrice(itemprice,opt01,opt02,opt03) {
if(opt01!=0) num01 = parseFloat(scan(opt01.options[opt01.selectedIndex].label)); else num01=0;
if(opt02!=0) num02 = parseFloat(scan(opt02.options[opt02.selectedIndex].label)); else num02=0;
if(opt03!=0) num03 = parseFloat(scan(opt03.options[opt03.selectedIndex].label)); else num03=0;
total = itemprice + num01 + num02 + num03;
totalusd = '$' + total;
return totalusd;
}
function totalPrice2(itemprice,opt01,opt02,opt03) {
if(opt01!=0) num01 = parseFloat(scan(opt01.options[opt01.selectedIndex].value)); else num01=0;
if(opt02!=0) num02 = parseFloat(scan(opt02.options[opt02.selectedIndex].value)); else num02=0;
if(opt03!=0) num03 = parseFloat(scan(opt03.options[opt03.selectedIndex].value)); else num03=0;
total = itemprice + num01 + num02 + num03;
totalusd = '$' + total;
return totalusd;
}

function addOrder(){
document.item01.amount.value = totalPrice(pd[q][7],optvar[0],optvar[1],optvar[2]);
document.item01.onsubmit=window.open("https://www.paypal.com/cart?add=1&business=contact%40mi-xology.com&currency_code=USD&lc=US","paypal","width=680,height=360,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes")
document.item01.submit();
}

function changeOption(q,optNum,optIndex,optGroupSelf,optGroup2,optGroup3,basePrice) {
optGroupSelf.options[optIndex].selected = true;
document.item01.total.value = totalPrice(basePrice,optGroupSelf,optGroup2,optGroup3);
  for (j = 1; j < pd[q][8][optNum].length; j++){
   link = "optlink"+optNum+j;
   if (j==optIndex){if(ie4)document.all[link].className="sel";else document.getElementById(link).className="sel";}
   else {if(ie4)document.all[link].className="nonsel";else document.getElementById(link).className="nonsel";}
  }
return false;
}

function viewCart() {
var paypal=window.open("https://www.paypal.com/cart?display=1&business=contact%40mi-xology.com","paypal","width=680,height=360,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes");
paypal.myParent=top;
if (paypal.opener == null) { paypal.opener = top; }
paypal.focus();
}



/**************
Showhide for various browsers
****************/

function showhide(what){
if(ie4) {
if (document.all[what].style.display=="none"){document.all[what].style.display="block";}
else{document.all[what].style.display="none";}
}
else
if (document.getElementById([what]).style.display=="none"){document.getElementById([what]).style.display="block";}
else{document.getElementById([what]).style.display="none";}
}
function showW(what){
if(ie4) document.all[what].style.display="block";
else document.getElementById([what]).style.display="block"
}
function hideW(what){
if(ie4) document.all[what].style.display="none";
else document.getElementById([what]).style.display="none"
}

function sh3(what){
if (what.style.display=="none"){what.style.display="block";}
else{what.style.display="none";}
}
function s3(what){
what.style.display="block";
}
function h3(what){
what.style.display="none";
}


function sh2(what,select){
if (what.className=='nosee'){
s2(what,select)
}
else{
h2(what,select)
}
}
function s2(what,select){
what.className='nowsee';
select.className='sel';
}
function h2(what,select){
what.className='nosee';
select.className='nonsel';
}

function loadTerm() {
var srchterm;
if(ie4)srchterm = top.masterdiv.sForm.sTerm.value;
else srchterm = top.masterdiv.document.sForm.sTerm.value;
return srchterm;
}


