var ns4 = (document.layers)? 1 : 0 ;
var ie = (document.all)? 1 : 0 ;
var usr = navigator.userAgent
var objns6 = (usr.indexOf('Netscape6')!=-1)? 1 : 0 ;
var ns = (document.getElementById)? 1 : 0 ;
var isMac = (navigator.userAgent.indexOf('Mac')!=-1) ;
var brsr = (navigator.appName.indexOf("Netscape")!=-1) ;

var larMenu = new Array(5);
var larMenua = new Array(5);
for (i=0;(i<5);i++) {
 larMenu[i] = new Image(159,10); 
 larMenu[i].src = 'images/lmenu_'+Number(i)+'.jpg';
 larMenua[i] = new Image(159,10); 
 larMenua[i].src = 'images/lmenu_'+Number(i)+'d.jpg';
}

var tarMenu = new Array(9);
var tarMenua = new Array(9);
for (i=0;(i<9);i++) {
 tarMenu[i] = new Image(83,32); 
 tarMenu[i].src = 'images/menu_'+Number(i)+'.jpg';
 tarMenua[i] = new Image(83,32); 
 tarMenua[i].src = 'images/menu_'+Number(i)+'d.jpg';
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function catresource_guide_2008() {
	win = window.open("http://clearimaging.com/cms/catalogs/jewell_resource_guide_2008/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function keystoneVideo() {
  win = window.open("http://keystonewalls.com/pages/pop_ups/CM_movie.html","_video","width=610,height=330,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
  win.focus();
}

function PlaySWFVideo() {
  win = window.open("http://www.belgardsoftware.com/sfw_video.htm","_video","width=650,height=610,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
  win.focus();
}

function showroomPittsburgh() {
 win = window.open("http://clearimaging.com/cms/showrooms/pittsburghcorning/popup.htm?signature=jewell", "_blank", "width=250, height=150, left=17, top=17, statusbar=no, toolbar=no, scrollbars=never, navbar=no");
 win.focus();
}

function trenwythShowroom() {
  win = window.open("http://www.clearimaging.com/cms/showrooms/trenwyth/popup.htm?signature=jewell", "_blank", "width=250, height=150, left=17, top=17, statusbar=no, toolbar=no, scrollbars=never, navbar=no");
  win.focus();
}

function showroomKeystone() {
  win = window.open("http://clearimaging.com/cms/showrooms/keystonewalls/popup.htm?signature=jewell", "_blank", "width=250, height=150, left=17, top=17, statusbar=no, toolbar=no, scrollbars=never, navbar=no");
  win.focus();
}

function showroomAshford() {
 win = window.open("http://clearimaging.com/cms/showrooms/ashfordbrick/popup.htm?signature=jewell", "_blank", "width=250, height=150, left=17, top=17, statusbar=no, toolbar=no, scrollbars=never, navbar=no");
 win.focus();
}

function visualizer() {
	win = window.open("http://clearimaging.com/cms/catalogs/VisualizerJewell/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catJewel_2010() {
	win = window.open("http://clearimaging.com/cms/catalogs/jewell_2010/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catJewel_2009() {
	win = window.open("http://clearimaging.com/cms/catalogs/jewell_2009/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catJewel_2008() {
	win = window.open("http://clearimaging.com/cms/catalogs/jewell_2008/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catJewel_2007() {
	win = window.open("http://clearimaging.com/cms/catalogs/jewell_2007/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogArchitectural() {
 win = window.open("http://www.clearimaging.com/cms/catalogs/belgard_binder/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 win.focus();
}

function catalog2006() {
	win = window.open("http://clearimaging.com/cms/catalogs/belgard_2006/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalog2004() {
  win = window.open("http://www.clearimaging.com/cms/catalogs/catalog2004/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
  win.focus();
}

function catalog2005() {
  win = window.open("http://www.clearimaging.com/cms/catalogs/belgard_catalog_2005/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
  win.focus();
}

function seizemoment() {
 win = window.open("http://clearimaging.com/cms/catalogs/catalog2003/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 win.focus();
}

function oasis() {
 win = window.open("http://clearimaging.com/cms/catalogs/oasis/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 win.focus();
}

function matteroftaste() {
 win = window.open("http://clearimaging.com/cms/catalogs/matter_of_taste/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 win.focus();
}

function nuance() {
 win = window.open("http://clearimaging.com/cms/catalogs/nuance/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 win.focus();
}

function guide() {
	win = window.open("http://clearimaging.com/cms/catalogs/guide/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function techart() {
  win = window.open("http://clearimaging.com/cms/catalogs/techart/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
  win.focus();
}

function showDufferinResidential() {
  win = window.open("http://www.dufferinstone.com/dufferin1/index.php","_blank","width=10,height=10,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function showDufferinCommercial() {
  win = window.open("http://www.dufferinstone.com/dufferin3/index.php","_blank","width=10,height=10,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}  

function catalogKeystoneIdea() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_idea/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneDesign() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_capping/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneStep() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_corners/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneDrainage() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_drainage/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneCountry() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_dream/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneGolf() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_golf/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneInstructions() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_install/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneManual() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_manor/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneMiscellaneous() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_miscel/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystonePlanter() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_planter/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneStandard() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_standard/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneComplete() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_steps/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneCompac() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_units/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function catalogKeystoneStraight() {
	win = window.open("http://www.clearimaging.com/cms/catalogs/keystone_straight/index.php?signature=jewell","_blank","width=250,height=150,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
	win.focus();
}

function _lastIndexOf(str, sstr) {
  var res = "";
  res = str;
  var index = -1;
  while (res.indexOf(sstr)!=-1) {
    if (index==-1) index = 0;
    index = index + res.indexOf(sstr);
    res = res.substring(index+1,res.length);
  }
  return index;
}

function zoomPage() {
  var pageName;
  var str = document.location.href;
  if (str.lastIndexOf("/")!=-1) {
    str = str.substring(str.lastIndexOf("/")+1, str.length);
    if (str=='') str='index.htm';
    var index = str.lastIndexOf(".htm");
    if (index==-1) {
      index = str.lastIndexOf(".php");
    }
    if (index!=-1) {
      pageName=str.substring(0,index);
      if (document.location.href.indexOf('enlarged/')==-1)
        pageName = 'enlarged/'+pageName;
      else
        pageName = '../'+pageName;
      pageName=pageName+str.substring(index,str.length);
      window.location=pageName;
    }
  }
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popup(adresa){
  var w=550 , h=400;
  var l=(screen.availWidth-w)/2 , t=(screen.availHeight-h)/2;
  win=window.open(adresa,"_blank","width="+w+",height="+h+",left="+l+",top="+t+",statusbar=no,toolbar=no,scrollbars=yes,navbar=no");
  win.focus();
}

function popupn(adresa){
  var w=450 , h=400;
  var l=(screen.availWidth-w)/2 , t=(screen.availHeight-h)/2;
  win=window.open(adresa,"_blank","width="+w+",height="+h+",left="+l+",top="+t+",statusbar=no,toolbar=no,scrollbars=no,navbar=no");
  win.focus();
}

function popup1(adresa, w, h){
  var l=(screen.availWidth-w)/2 , t=(screen.availHeight-h)/2;
  win=window.open(adresa,"_blank","width="+w+",height="+h+",left="+l+",top="+t+",statusbar=no,toolbar=no,scrollbars=yes,navbar=no");
  win.focus();
}

function getParameter(str, name) {
  var res = "";
  if (str.indexOf("?")!=-1) {
    str = str.substring(str.indexOf("?")+1, str.length);
    if (str.indexOf(name)!=-1) {
      if (str.indexOf("&"+name, str.indexOf(name)+name.length)!=-1)
        res = str.substring(str.indexOf("&"+name)+name.length+1, str.indexOf("&"+name))
   	  else
        res = str.substring(str.indexOf(name)+name.length+1, str.length);
      if (res.indexOf("&")!=-1)
        res = res.substring(0,res.indexOf("&"));
   	}
  }
  return res;
}

function showImage(id, src) {
  if (ie)
   	document.all[id].src = src;
  else if (ns)
	   document.getElementById(id).src = src;
}

function showBig(imageName, width, height) {
  win = window.open("big_image.htm?img="+imageName+"&width="+width+"&height="+height,"_blank",
   "width="+Number(width+40)+",height="+Number(height+150)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}



function showElement(id) {
  if(ie)
   	document.all[id].style.visibility = "visible";
  else if (ns)
   	document.getElementById(id).style.visibility = "visible";
}

function hideElement(id) {
  if(ie)
   	document.all[id].style.visibility = "hidden";
  else if (ns)
   	document.getElementById(id).style.visibility = "hidden";
}

function showhideElement(id) {
  if (ie) {
    if (document.all[id].style.visibility == "hidden")
      document.all[id].style.visibility = "visible";
    else
      document.all[id].style.visibility = "hidden";
  }
  else if (ns) {
    if (document.getElementById(id).style.visibility == "hidden")
  	   document.getElementById(id).style.visibility = "visible";
    else
  	   document.getElementById(id).style.visibility = "hidden";
  }
}

function showMessage(id, text) {
  if(ie)
   	document.all[id].innerHTML = text;
  else if (ns)
   	document.getElementById(id).innerHTML = text;
  showElement(id);
}

function dealerLocator(zip) {
  win = window.open("dealerlocator.htm?zip="+zip,"_blank","width=770,height=500,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function dealerMap(x,y) {
  var win = window.open("dealerlocator.htm?x="+x+"&y="+y,"_blank","width=770,height=500,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}
// Modified 28.01.2004 - Begin ----------------------------------------------------------
function fBelgardCatSave(yy) 
{
	page = "www_save_playground.htm";
	if(yy==3)
		page = "www_save_seizemoment.htm";
	if(yy==2)
		page = "www_save_matter.htm";
	if(yy==1)
		page = "www_save_nuance.htm";
  
  winSV = window.open(page,"winSV","width=400,height=150");
  winSV.focus();
}

function showImagePopup(scriptName,section,ind,width,height) {
  width = (width>750)?750:width;
  height = (height>500)?500:height;
  width+=70;
  height+=170;
  width = (width<350)?350:width;
  height = (height<200)?200:height;
  win = window.open('big_image.htm?script='+scriptName+'&section='+section
	+'&ind='+ind,'_blank','width='+width+',height='
	+height+',left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no');
  win.focus();
}

function showImagePopup1(scriptName,section,ind,width,height) {
  width = (width>750)?750:width;
  height = (height>500)?500:height;
  width+=50;
  height+=150;
  width = (width<300)?320:width;
  height = (height<200)?200:height;
  win = window.open('big_image1.htm?script='+scriptName+'&section='+section
	+'&ind='+ind,'_blank','width='+width+',height='
	+height+',left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no');
  win.focus();
}

 var message = 
':. For the Company Contact Information,' + String.fromCharCode(13,10)+
'   please click on the <Contact Us> site link.' + String.fromCharCode(13,10)+
':. For Website and Technical Support,' + String.fromCharCode(13,10)+
'   visit us at: www.clearimaging.com' + String.fromCharCode(13,10)+
':. Website Source Code Copyrighted by' + String.fromCharCode(13,10)+
'    Clear Imaging '+(new Date()).getFullYear();
  
function clickIE4(){
  if (event.button==2){
    alert(message);
    return false;
  }
}

function clickNS4(e){
  if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
      alert(message);
      return false;
    }
  }
}

if (document.layers){
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
  document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false");
