/*        JavaScript functions for IPS-2 details.php  */

      function jsBigImgPopUp(cid)
      { fwin=window.open(cid.href,'_blank','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=665,height=575');
        if(fwin!=null){ return false;}else{return true;}
      }
      function jsFriendPopUp(cid)
      { fwin=window.open(cid.href,'_blank',"width=400,height=300,resizable=1");
        if(fwin!=null){ return false;}else{ return true;}
      }
      function jsContactPopUp(cid)
      { cwin=window.open(cid.href,'_blank',"width=780,height=680,resizable=1,scrollbars=1,left=200,top=100");
        if(cwin!=null){ return false;}else{ return true;}
      }
      function jsCrAppPopUp(cid)
      { cwin=window.open(cid.href,'_blank',"width=800,height=800,resizable=1,scrollbars=1");
        if(cwin!=null){ return false;}else{ return true;}
      }   
      function js_AutoCheckPopUp(cid)
      { cwin=window.open(cid.href,'_blank','width=450,height=500,resizable=1,scrollbars=1');
        if(cwin!=null){ return false;}else{ return true;}
      } 
      function js_UnityWorksPopUp(cid)
      { cwin=window.open(cid.href,'_blank','width=340,height=330,resizable=0,scrollbars=0');
        if(cwin!=null){ return false;}else{ return true;}
      }
      function js_VideoPopUp(cid,ww,wh)
      { cwin=window.open(cid.href,'_blank','width='+ww+',height='+wh+',resizable=0,scrollbars=0,left=200,top=100');
        if(cwin!=null){ return false;}else{ return true;}
      }
      function js_GeneralPopUp(cid,ww,wh)
      { cwin=window.open(cid.href,'_blank','width='+ww+',height='+wh+',resizable=1,scrollbars=1,left=200,top=100');
        if(cwin!=null){ return false;}else{ return true;}
      }
      function jsEstimatePopUp(cid)
      { estwin=window.open(cid.href,'_blank',"scrollbars=1,width=450,height=600,resizable=1");
        if(estwin!=null){ return false;}else{ return true;}
      }
      function jsDoBlink()
      { var x = 0;
        var elm;
        do
        { elm=document.getElementById("blinkthis"+x);
          //alert("DoBlink insection x,elm="+x+", "+elm);
          if(elm)
		      { elm.style.visibility = elm.style.visibility == "visible" ? "hidden" : "visible";
		        x++;
		      }
		      else
		      { break;
		      }
        } while ( x < 25) // just a precaution
      }
      
      function jsStartBlink()
      { var elm=document.getElementById("blinkthis0");
        //alert("startblink elm="+elm);
        if(document.getElementById("blinkthis0"))
        { setInterval("jsDoBlink()", 500);
        }
      }
      function jsGetElementLeftPosition(elemID)
      { var offsetTrail = document.getElementById(elemID);
        var offsetLeft = 0;
        while (offsetTrail)
        { offsetLeft += offsetTrail.offsetLeft;
          offsetTrail = offsetTrail.offsetParent;
        }
        if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined")
        { offsetLeft += document.body.leftMargin;
        }
        return offsetLeft;
      }
      function jsGetElementTopPosition(elemID)
      { var offsetTrail = document.getElementById(elemID);
        var offsetTop = 0;
        while (offsetTrail)
        {
          //alert("offsetTrail is now: " + offsetTrail.tagName);
          //alert("offsetTop of that element is: " + offsetTrail.offsetTop);
          offsetTop += offsetTrail.offsetTop;
          offsetTrail = offsetTrail.offsetParent;
        }
        if ((navigator.userAgent.indexOf("Mac") != -1) && (typeof document.body.leftMargin != "undefined"))
        { offsetTop += document.body.topMargin;
        }
        var IE = document.all?true:false
        if (IE)
        { var offset = 35;
        }
        else
        { var offset = 0;
        }
        return offsetTop + offset;
      }
      function js_ShowTip(divid,tip,x,y)
      { elm=document.getElementById(divid);
        //elml=imgid;
        elm.innerHTML='<p>'+tip+'<\/p>';
        //elm.style.height=elml.style.height;
        elm.style.top=parseInt(y)+'px';
        elm.style.left=parseInt(x)+'px';
        elm.style.visibility = "visible";

      }
      function js_HideTip(divid)
      { elm=document.getElementById(divid);
        elm.innerHTML="";
        elm.style.visibility="hidden";
      }
      
      function js_SetPFColors(title)
      { StdLib_SetUserAgent();
        var sobj, robj, i;
        var rlist = [ [".ApplDet_FeaturesText", "black"],
                      [".Appl_BodyTextOnly", "black"],
                      [".Appl_Body", "black"],
                      [".Appl_Data", "black"],
                      [".Appl_GasPumpTitle", "black"],
                      [".ApplDet_PhoneUnderPicture", "black"],
                      [".ApplDet_FeaturesText", "black"],
                      [".ApplDet_VBRVFeaturesList", "black"],
                      [".ApplDet_NewArrival", "black"],
                      [".ApplDet_PriceUnderPicture", "black"],
                      [".ApplDet_Title", "black"]];
        sobj=StdLib_FindStyleSheet(title);
        if(sobj != false)
        { for(i=0; i<rlist.length; i++)
          { robj=StdLib_FindCssRule(sobj,rlist[i][0]);
            if(robj != false)
            { robj.style.color=rlist[i][1];
            }
          }
        }
      }
      function js_SetActiveStyleSheet(title)
      { var i, a, main;
        for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
        { if((a.getAttribute("rel").indexOf("style") != -1) && a.getAttribute("title"))
          { a.disabled = true;
           if(a.getAttribute("title") == title)
           {  //alert("found and enabled "+title);
              a.disabled = false;
           }
          }
        }
      }
      function js_Initialize()
      { StdLib_SetUserAgent();
        jsStartBlink();
      }

