var moretxtvalue='';
var nRec = 0;
var related = new Array();
var CurrItemId='addcook';
var ie = false;
var ns6 = false;
var ns = false;
var opera = false;

if (eval(document.layers)) { ns=true; }
else {
    if (eval(document.all)) { ie=true; if (navigator.userAgent.indexOf('Opera')!=-1) opera=true;}
        else {
            if (eval(document.getElementById)) { ns6=true;}
            }
    }

function openForm1() {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('http://site.factorydirectmarket.com/custom/contact.php', 'EnlargePicture','width=595,height=615,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}

function openForm2() {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo1 = new Object();
    MoreInfo1 = window.open('http://site.factorydirectmarket.com/custom/quote_request.php', 'EnlargePicture1','width=595,height=615,scrollbars=yes,resizable=yes,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function onFocusSearch(obj){
  if (!obj.changed) obj.value = '';
  obj.style.color = '#000000';
}

function onBlurSearch(obj){
  if (!obj.value) {
    obj.changed = false;
    obj.value = 'Search';
    obj.style.color = '#7f7f7f';
  } else {
    obj.changed = true;
  }  
  
}

function checkSearch(obj) {
  if (!obj.changed  || obj.value == '') {
    alert('Enter search keywords!');
    return false;
  }
  return true;
}


// Hide and Show menu

//finds and return <DIV> object by given name


function Layer(layerName) {
return (ns)?(document.layers[layerName]):((ns6)?(document.getElementById(layerName)):(document.all(layerName)));
}
function enlarge(url,imgw,imgh) {
var leftPos = (screen.availWidth-900) / 2;
var topPos = (screen.availHeight-600) / 2;
imgw=eval(imgw)+20;
imgh=eval(imgh)+30;
window.open(url, 'EnlargePicture','width='+imgw+',height='+imgh+',scrollbars=no,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}

function TellToFriend() {
var NewPop = new Object();
NewPop=window.open("http://site.factorydirectmarket.com/custom/ytellafriend.php?link="+pid.toLowerCase(),"tellafriend","HEIGHT=430,WIDTH=790,scrollbars=yes,resizable=yes,top=50,left=50");
NewPop.window.focus();
}
function PriceRequest() {
var NewPop = new Object();
NewPop=window.open("http://site.factorydirectmarket.com/custom/pricerequest.php?link="+pid.toLowerCase(),"pricerequest","HEIGHT=150,WIDTH=520,scrollbars=yes,resizable=yes,top=50,left=50");
NewPop.window.focus();
}

function maillist(emailval) {
var NewPop = new Object();
NewPop=window.open('http://site.factorydirectmarket.com/custom/addemail.php?mail='+emailval,'popupemail','HEIGHT=165,WIDTH=520,scrollbars=yes,resizable=yes,top=50,left=50');
NewPop.window.focus();
}

function makeavailable(num,state) {
    obj=eval("document.forms.multiorder.vwquantity"+num)
    obj.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
    obj2=eval("document.forms.multiorder.vwitem"+num)
    obj2.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))

for(i=0;i<document.forms.multiorder.elements.length; i++){
obj3 = document.forms.multiorder.elements[i];

	if(obj3.name.indexOf('vwattr'+num)!=-1){
		    obj3.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
	}

}
	
	//alert(document.forms.multiorder.elements.length)
	
}


function openImages() {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('images.html', 'EnlargePicture','width=600,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
//  MoreInfo.preloadimg(images);
}
function openVideos(num) {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('videos.html?video='+num, 'EnlargePicture','width=600,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function openShipping(num) {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('shipping-calc.html', 'EnlargePicture','width=600,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function openDelivery(num) {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('delivery-est.html', 'EnlargePicture','width=1000,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}

function retriveimages(arrname) {
return eval(arrname);
}


function PasteItem(num) {
var expdate = new Date (); 
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
cookievar='rotator'+num;
Items=eval('Items'+num);
if (!GetCookie(cookievar)) {
    SetCookie(cookievar, 1, expdate);
    }
if (!GetCookie(cookievar)) {
    cur=Math.round(Math.random()*(Items.length-1));
    }
    else {
    cur=eval(GetCookie(cookievar));
    }


if (Items[cur]) {
    document.write(Items[cur]);
    cur=cur+1;
    SetCookie(cookievar, cur, expdate);
    }
    else {
        if (Items[1]) {
        document.write(Items[1]);
        SetCookie(cookievar, 2, expdate);
        }
    }
}


function insertMoreDet() {
if (moretxtvalue!='') {
    var leftPos = 0;
    var topPos = 0;
    var MoreInfo = new Object();
	txt1='<html><head><title>Devine Medical Supplies</title><link href="http://site.factorydirectmarket.com/css/main.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff" marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" link="#003399" vlink="#003399" alink="#003399">';
    txt1=txt1+'<table width="100%" background="http://site.factorydirectmarket.com/i/t5a2.gif"><tr><td><img src="http://site.factorydirectmarket.com/i/t5a1.gif" width="28" height="100" alt="" border="0"><br></td><td class="al1"><img src="http://site.factorydirectmarket.com/i/popuplogo.gif" width="280" height="63" alt="" border="0"><br></td><td align="right"><img src="http://site.factorydirectmarket.com/i/t5a3.gif" width="28" height="100" alt="" border="0"><br></td></tr></table><!--block-->';
    txt1=txt1+'<table width="100%" align="center" style="border:1px solid #255B97"><tr valign="top"><td align="center" style="padding:20px 0">';
    txt2='</td></tr></table><!--/block--></body></html>';
    MoreInfo = window.open('more_info.html', 'EnlargePicture','width=1000,height=500,scrollbars=yes,resizable=yes,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
    MoreInfo.document.write(txt1+moretxtvalue+txt2);
    }
else {
    alert('Your browser settings not allow to run scripts or version of your browser is old.');
    }
}