﻿// JScript File
//Author: Andy Harmer
//Created: 24/07/2006

function showMessage(obj,ev)
{    
    document.getElementById("divMessage").style.display = "";
    document.getElementById("divMessage").style.zIndex = 1;
    //self.setTimeout('hideMessage()', 5000) 
    self.setTimeout('fadeOut()',4000);
}

function OnTop()
{
   document.getElementById("divMessage").style.zIndex = -1;
}

function hideMessage()
{
   document.getElementById("divMessage").style.display = "none";
   document.getElementById("divMessage").style.filter = "alpha(style=0,opacity=100)";
   opac2 = 100;
}

//fades layer out
ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac2 = 100;

function fadeOut() {
if(opac2 > 0){
opac = 0;
opac2-=20;
if(ie5){document.getElementById("divMessage").style.filter = "alpha(style=0,opacity="+opac2+")";}
if(ns6){document.getElementById('divMessage').style.MozOpacity = opac2/100;}
self.setTimeout('fadeOut()', 0);
}
else
{
    hideMessage();
}
}


function surfto(form) 
{
	var myindex=form.select1.selectedIndex;
    if (form.select1.options[myindex].value != "0") 
    {
        top.location=form.select1.options[myindex].value;
    }
}
function clearText(oTxt)
{
    oTxt.value="";
   
}


function ColorOpen()
{
	
	window.open('/popups/colorstrology/4_images.htm', 'window','width=770,height=510,scrollbars=no,resizable=no,menubar=0');
}


function urlencode(str) {
return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

function LargerPic(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,locationbar=no,statusbar=no,width=300,height=550");}
function guide2guides(PageName){window.open (PageName,"new_window","width=700,height=500,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=150,top=50,screenx=150,screeny=50");}
function StartGallery(page){OpenWin=this.open(page,"ControlWindow9","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=700,height=440");}
function StartMyPantomeInfo(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300");}
function ColorCuePop(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=510,height=475,left=250,top=250");}
function ContestRules(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=550,height=625");}
function Winpop(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=500,height=425");}
function StartBidaycolor(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=685,height=440");}
function PrinterSupport(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=456,height=500");}
function StartPantoneUniverse(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=650,height=440");}
function WinOpen(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=600,height=600");}
function Start(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=300,height=400");}
function StartProdFeature(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=300,height=400");}
function StartProdDemo(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=300,height=400");}
function Start911Popup(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=540,height=330");}
function StartRules(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=325,height=500");}
function StartCogixPolls(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=650,height=450,left=150,top=50,screenx=150,screeny=50");}
function StartCogixPolls1(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=650,height=600,left=150,top=50,screenx=150,screeny=50");}
function StartCogixCustSatis(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=650,height=450,left=150,top=50,screenx=150,screeny=50");}
function OpenPDFWin(page,winName){OpenWin=this.open(page,winName,"toolbar=no,menubar=no,location=no,status=0,titlebar=0");}
function StartFnHPoll(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=650,height=450,left=250,top=250");}
function popVideo(href,name,options){
if(href){
if(options==null) options="location=yes,menubar=yes,resizable=yes,status=yes,scrollbars=yes,toolbar=yes";
if(name==null) name="popWindow1";
var poppedWindow=window.open(href,name,options);
poppedWindow.focus();
}
}

function PopVideo(href,name,options){
if(href){
if(options==null) options="location=yes,menubar=yes,resizable=yes,status=yes,scrollbars=yes,toolbar=yes";
if(name==null) name="popWindow1";
var poppedWindow=window.open(href,name,options);
poppedWindow.focus();
}
}



function productfeatures(filename)
{
	window.open(filename, 'window', 'width=500,height=500,scrollbars=yes,resizable=no,menubar=0');
}


//added as a test
var popUpWin=0;
function popUpWindow(URLStr,left,top,width,height)
{
if(popUpWin)
{
if(!popUpWin.closed)popUpWin.close();
}
popUpWin=open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=no,width=200,height=200,left='+left+',top='+top+',screenX='+left+',screenY='+top+'');}
//added as a test
var popUpWin1=0;
function popUpWindow1(URLStr,left,top,width,height)
{
if(popUpWin1)
{
if(!popUpWin.closed)popUpWin.close();
}
popUpWin1=open(URLStr,'popUpWin1','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
}
function startLg(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=762,height=528");}
function StartLarge(page){OpenWin=this.open(page,"CtrlWindowLg","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=530,height=550");}
function startExpired(page){OpenWin=this.open(page,"ControlWindowEx","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=625,height=445");}
function startDetail(page){OpenWin=this.open(page,"ControlWindowDet","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=225,height=375");}
function startMonitor(page){OpenWin=this.open(page,"ControlWindowMon","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=485,height=450");}
function startAnimbldg(page){OpenWin=this.open(page,"ControlWindowBldg","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=600,height=500");}
function startAnimpln(page){OpenWin=this.open(page,"ControlWindowPln","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=550,height=450");}
function startAnimgir(page){OpenWin=this.open(page,"ControlWindowGir","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=400,height=500");}
function startAnimsurv(page){OpenWin=this.open(page,"ControlWindowSurv","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=500,height=390");}

function StartCC2ContestRules(page){OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=480,height=540,left=150,top=50,screenx=150,screeny=50");}

function MM_displayStatusMsg(msgStr) { status=msgStr; document.MM_returnValue = true; }
/*
****** DO NOT DELETE THE FOLLOWING COMMENTED OUT FUNCTION. ******
function ColorVANTAGE_Calc(page){OpenWin=this.open(page,"ControlWindow","toolbar=no,menubar=no,locationbar=no,scrollbars=no,resizable=no,statusbar=false,width=596,height=646");}
*/

/* --------------- pop_new.js code follows here TJS(2006_09_21) -------------------- */
function StartFaqs(page) {
OpenWin = this.open(page, "CtrlWindowF", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=473,height=400");
}

function StartCC2(page) {
OpenWin = this.open(page, "CtrlWindowC", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=614,height=320");
}

function StartInt(page) {
OpenWin = this.open(page, "CtrlWindowI", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=568,height=295");
}

function StartIntSm(page) {
OpenWin = this.open(page, "CtrlWindowI", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=568,height=234");
}

function StartTips(page) {
OpenWin = this.open(page, "CtrlWindowI", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=400,height=400");
}

//FOR EYE ONE PRODUCT COMPARISON - TAM 072106

function StartComp(page) {
OpenWin = this.open(page, "CtrlWindowC", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=570,height=535");
}


//FOR FAVORITE COLOR SURVEY - TAM 041706

function StartFav(page) {
OpenWin = this.open(page, "CtrlWindowF1", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=700,height=525");
}

//FOR FNH POLL - TAM 061506
function StartFnHPoll(page){OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=650,height=450,left=250,top=250");
}

//FOR STATIC FLOW - TAM 061506
function StartFlow(page){OpenWin = this.open(page, "CtrlWindowFlow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=675");
}

//FOR PAINT PRIMER LEARN MORE - TAM 083006
function StartPrimer(page){OpenWin = this.open(page, "CtrlWindowPrimer", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300");
}

//FOR PAINT VOC WHATS THIS - TAM 083106
function StartVoc(page){OpenWin = this.open(page, "CtrlWindowVoc", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300");
}


//FOR PORTFOLIO POP UPS - TAM 031606
function StartPort1(page) {
OpenWin = this.open(page, "CtrlWindowP1", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort2(page) {
OpenWin = this.open(page, "CtrlWindowP2", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=350,height=535");
}

function StartPort3(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort4(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort5(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort6(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort7(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}

function StartPort8(page) {
OpenWin = this.open(page, "CtrlWindowP3", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=450,height=535");
}


//FOR PAINT PRIMER LEARN MORE - TAM 083006
function StartPrimer(page){OpenWin = this.open(page, "CtrlWindowPrimer", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300");
}

//FOR PAINT VOC WHATS THIS - TAM 083106
function StartVoc(page){OpenWin = this.open(page, "CtrlWindowVoc", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300");
}




//added for search image tabs
function PreloadTabs(section){
    switch (section){
        case 1 :MM_preloadImages('/images/search/search_tabs_prod_f4.jpg','/images/search/search_tabs_prod.jpg','/images/search/search_tabs_prod_f3.jpg','/images/search/search_tabs_prod_f2.jpg');break;
        case 2 :MM_preloadImages('/images/search/search_tabs_articles_f4.jpg','/images/search/search_tabs_articles.jpg','/images/search/search_tabs_articles_f3.jpg','/images/search/search_tabs_articles_f2.jpg');break;
        case 3 :MM_preloadImages('/images/search/search_tabs_categories_f4.jpg','/images/search/search_tabs_categories.jpg','/images/search/search_tabs_categories_f3.jpg','/images/search/search_tabs_categories_f2.jpg');break;
        case 4 :MM_preloadImages('/images/search/search_tabs_press_f4.jpg','/images/search/search_tabs_press.jpg','/images/search/search_tabs_press_f3.jpg','/images/search/search_tabs_press_f2.jpg');break;       
	}
}

//CJ: 3/6/2007 hueypro product page
function openDesc(id)
{
   var oDiv = document.getElementById(id);
   var sStyle = oDiv.style.display;

   if (sStyle == "none")
   {
       sStyle = "";
   }
   else
   {
      sStyle = "none";
   }

   oDiv.style.display = sStyle;
}

//activity indicator loader
function loader(id)
{
    var oSpan = document.getElementById(id);
    oSpan.style.display = "";
}

//CJ: 6/3/2007 SMART scripts
function validateQuantity(oText,iMin,iProductID,bCheckout)
{
    var iCur = oText.value - 0;
    var sValue = '';
    var iOk = 0;
    
    if ((iCur < iMin) && (iCur >= 0))
    {
        if (bCheckout == true)
        {
            sValue = iMin;
        }
        else
        {
            sValue = '';
        }
        
        if (iCur > 0)
        {
        oText.value = sValue;
        alert("The minimum quantity to complete an order is " + iMin + ".")
        oText.focus();
        }
        else
        {
            oText.value = '';
        }
    }
    else
    {
        iOk = 1;
    }
    
    if (iProductID != 0)
    {
        //enabeld the checkbox that we have just entered a min quantity for   
        var oElements = document.getElementsByName("chkColorsSpectral");
        var oCheckAll = document.getElementById("chkAll");
        var iAtLeastOne = 0;
            
        for (var e = 0; e < oElements.length; e++)
        {
            if (oElements[e].value == iProductID)
            {
                if (iOk == 1)
                {
                    oElements[e].disabled = false;
                }
                else
                {
                    oElements[e].disabled = true;
                    oElements[e].checked = false;
                }
            }
        }    

        //lets check that at least one is enabled
        for (var e = 0; e < oElements.length; e++)
        {
            if (oElements[e].disabled == false)
            {
                iAtLeastOne = 1;
                break;
            }
        }    
            
        if (iAtLeastOne == 1)
        {
            oCheckAll.disabled = false;        
        }
        else
        {
            oCheckAll.disabled = true;
        }
    }
}
