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) ;

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 showBigPortfolio(imageName)
{
  win = window.open("big_portfolio.htm?path="+imageName,"_portfolio","width=700,height=550,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,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 showroom()
{
 // win = window.open("showroom/index.htm","_blank","width=748,height=485,left=17,top=17,statusbar=no,toolbar=no,scrollbars=never,navbar=no");
 // win.focus();
}

function showBigPattern(pageName, width, height)
{
  height = height + 112;
  if (height<218)
    height = 218;
  width = width + 60;
  win = window.open(pageName,"_blank","width="+Number(width)+",height="+Number(height)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function showBigConcrete(imageName, windowName, width, height)
{
  height = height + 180;
  if (height<418)
    height = 418;
  width = width + 70;
  win = window.open("big_concrete2.htm?path="+imageName,windowName,"width="+Number(width)+",height="+Number(height)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}
function showBigColorChart(imageName, windowName, width, height)
{
  height = height + 90;
  if (height<418)
    height = 418;
  width = width + 400;
  win = window.open("big_colorchart.htm?path="+imageName,windowName,"width="+Number(width)+",height="+Number(height)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function showBigColor(pageName)
{
  width =  457;
  height = 348;
  height = height + 110;
  if (height<418)
    height = 418;
  width = width + 60;
  win = window.open(pageName,"colorchart","width="+Number(width)+",height="+Number(height)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function showTeeBinder(){
  win = window.open("techart/bindermini.htm","_techart_mini","width=559,height=407,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function showBinder()
{
  win = window.open("flipbinder/index.php","newbindermini","width=10,height=10,left=17,top=17,statusbar=no,toolbar=no,scrollbars= never,navbar=no");
  win.focus();
}

function loadfocus()
{
  if ((navigator.appName== "Netscape" && parseInt(navigator.appVersion) >= 4)|| (navigator.appName.indexOf("Microsoft") != -1 && parseInt(navigator.appVersion) > 3))
    browserVer = '1';
  else
    browserVer = '2';
  if (browserVer == 1)
	window.focus();
  return true;
}

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 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 changeStyle(id, ctype, colorin) {

var theight="";
var tborder="";
var tcursor="";

theight = "14";
if (ctype == 1) 
{
  tborder = "1px solid "+colorin;
  tcursor = "hand";
}  
else
 {
  tborder = "1px solid "+colorin;
  tcursor = "none";
 } 
 
  if (ie)
  {
   	document.all[id].style.border = tborder;
	document.all[id].style.cursor = tcursor;
	document.all[id].style.height = theight;
  }	
  else if (ns)
  {
	document.getElementById(id).style.border = tborder;
	document.getElementById(id).style.cursor = tcursor;
	document.getElementById(id).style.height = theight;		
  }	   
}

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.htm?path="+imageName+"&width="+width+"&height="+height,"_blank","width="+Number(width+70)+",height="+Number(height+100)+",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].innerText = text;
  else if (ns)
   	document.getElementById(id).innerHTML = text;
  showElement(id);
}

 var message = 
    "   For More Information About Us   " + String.fromCharCode(13,10)
  + " Call 800 741-2861 or Visit Us at: " + String.fromCharCode(13,10)
  + "      www.clearimaging.com         " + String.fromCharCode(13,10)
  + "   All Source Code Copyrighted     " + String.fromCharCode(13,10)
  + "    by Clearimaging.com © 2004     ";
  
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");
