var NS = (document.layers) ? 1 : 0;
var IE = (document.all && document.getElementById) ? 1 : 0;
var N6 = (!document.all && document.getElementById) ? 1 : 0;

function MM_findObj(n, d) { //v3.0
  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); return x;
}
/* Functions that swaps images. */
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 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;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function loadImages(){
   MM_preloadImages('/images/menu_button_about_off.gif','/images/menu_button_about_on.gif','/images/menu_button_artist_off.gif','/images/menu_button_artist_on.gif','/images/menu_button_contact_off.gif','/images/menu_button_contact_on.gif','/images/menu_button_exhibitions_off.gif','/images/menu_button_exhibitions_on.gif','/images/menu_button_join_mailing_off.gif','/images/menu_button_join_mailing_on.gif','/images/logo.gif','/images/copyright_catst.gif');
}

function GetStyle(name) {
   if (document.getElementById)
      return document.getElementById(name).style;
   else if (document.all)
      return document.all[name].style;
   else {
      var el = document.layers[name];
      if (el != null)   return el;
      for (var i=0; i<document.layers.length; i++) {
         el = document.layers[i].document.layers[name];
         if (el != null)   return el;
      }//end-for-i
   }//end-if  
}//end-func-GetStyle

function styleRoll(span, vis) {
   var el = GetStyle(span);
   var state = vis? 'visible':'hidden';
   el.visibility = state;
}//end-func-styleRoll

function imageSwap3On(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, true);
}//end-func-imageSwap3On

function imageSwap3Off(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, false);
}//end-func-imageSwap3Off

function imageSwap2(theImage, theSrc) {
   if (document.images) {
      var img = document.images[theImage];
      if (img)   img.src = theSrc;
      else {
         for (var i=0; i<document.images.length; i++) {
            if (document.images[i].name == theSrc) {
               document.images[i].src = theSrc;
               return;
            }//end-if
         }//end-for-i
      }//end-if-img
   }//end-if-document.images
}//end-func-imageSwap2

var winImage;
function showImage(file,width,height,bgcolor,center,popup){
		if(bgcolor=='') bgcolor='FFFFFF';
                content = "<HTML>\n";
                content += "<BODY TOPMARGIN=0 LEFTMARGIN=0 BGCOLOR=#"+bgcolor+">\n";
		if(center=='Y') content += "<CENTER>\n";
                content += "<IMG SRC='"+file+"' BORDER=0>";
		if(center=='Y') content += "</CENTER>\n";
                content += "</BODY>\n";
                content += "</HTML>\n";
		if(popup=='Y'){
                	winWidth = width+20;
                	winHeight = height;
                	args='top=50,left=200,screenX=0,screenY=0,width='+winWidth+',height='+winHeight+',scrollbars=yes,resizable=yes';
		}else{
                	if ((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)<=4)) {
                        	winWidth = screen.availWidth;
                        	winHeight = screen.availHeight
			}else{
                		winWidth = screen.Width;
                		winHeight = screen.Height;
			}
                	args='top=0,left=0,screenX=0,screenY=0,width='+winWidth+',height='+winHeight+',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
		}
                if(winImage) winImage.close();
                winImage=window.open("","Win",args);
                winImage.document.write(content);
                winImage.opener=self;
                winImage.focus();
}


function View2(winname,theURL)
{
        var top = 250;
        var left = 250;
        width = 160;
        height = 150;
        msgWindow = window.open(theURL,winname,'menubar=no,scrollbars=no,toolbar=no,location=no,titlebar=no,resizable=no,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        if (msgWindow.opener == null)
                msgWindow.opener = self;

}

function View4(winname,theURL)
{
        var top = 50;
        var left = 50;
        width = 680;
        height = 600;
        msgWindow = window.open(theURL,winname,'menubar=no,scrollbars=yes,toolbar=no,location=no,titlebar=no,resizable=yes,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        if (msgWindow.opener == null)
                msgWindow.opener = self;

}

/*
function View3(winname)
{
        var top = 250;
        var left = 250;
        width = 160;
        height = 150;
        msgWindow = window.open('',winname,'menubar=no,scrollbars=no,toolbar=no,location=no,titlebar=no,resizable=no,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        if (msgWindow.opener == null)
                msgWindow.opener = self;

}
*/

// used in artist detail page 
function ProductsView(theURL) {
	var top = 10;
	var left = 10;
	width = 506;
	height = 600;
        msgWindow = window.open('','','menubar=no,scrollbars=no,toolbar=no,location=no,titlebar=yes,resizable=no,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        msgWindow.location.href = theURL;

        if (msgWindow.opener == null)
                msgWindow.opener = self;
}

function ProductsView2(theURL) {
        var top = 10;
        var left = 10;
        width = 506;
        height = 600;

	msgWindow = window.showModalDialog(theURL,null,'scroll=no,status=no,center=yes,resizable=no,help=no,dialogWidth='+width+',dialogHeight='+height+',dialogLeft='+left+',dialogTop='+top+'');

}

function View(winname,theURL,top,left,width,height)
{

        msgWindow = window.open('','','menubar=no,scrollbars=no,toolbar=no,location=no,titlebar=yes,resizable=yes,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        msgWindow.location.href = theURL;

        if (msgWindow.opener == null)
                msgWindow.opener = self;

}

function displayPopup(width, height, title, imageURL){
//	alert ("11");
	var str = "scrollbars=no,width="+width+",height="+height+",status=no,left=100,screenX=0,top=100,screenY=0";
//	str += ",resizable"; // so the user can resize the newwindow manually
	var newwin = window.open('','', str);
	var content = "";
	content += "<html>\n\r";
	content += "<title>"+title+"</title>\n\r";
	content += "<head>\n\r";
	content += "<script language=javascript src=\"/common.js\"></script>\n\r";
	content += "<link href=\"/common.css\" rel=\"stylesheet\" type=\"text/css\">\n\r";
	content += "</head>\n\r";
	content += "<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n\r";
	content += "<table cellpadding=0 cellspacing=0 valign=top class=\"pinkbar\" width=100% height=100% border=0>\n\r";
	content += "<tr><td><img src=\""+imageURL+"\" border=0></td></tr>\n\r";
	content += "</table>\n\r";
	newwin.document.write(content);
}

function writetext(what,imgName,divName) {
document.getElementById('artworkblurb').innerHTML=''+what+'';
document.images[divName].src = imgName;

}
function notext(divName) {
document.getElementById('artworkblurb').innerHTML='';
document.images[divName].src = '/images/blank.gif';
}

function mouseImg(imgName,divName) {
document.images[divName].src = imgName;

}
function noImg(divName) {
document.images[divName].src = '/images/blank.gif';
}
