﻿// JScript File
  
function segetWindowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

   return [ myWidth, myHeight ];
}



function segetScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
	
}


//


function right(e) {

    if (navigator.appName == 'Netscape' && e.which == 3) {
        sehidelightwindowimage();
    return false;
    }
    
    if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
        sehidelightwindowimage();
       return false;
    }
    else return true;
}


var downlinkname = "&nbsp;&nbsp;Download";
var orderlinkname = "Bestel CMYK";
function sewritediv(divid, breedte, hoogte, pdownlinkname, porderlinkname){

    //downlinkname = pdownlinkname;
    //orderlinkname = porderlinkname;
    
    Obj = document.getElementById(divid);
   
    if (Obj == undefined || Obj == null){

         document.write("<div id='blackback' onclick='javascript:sehidelightwindowimage();' style='z-index:11100;filter:alpha(opacity=80);-moz-opacity:.8;opacity:.8;display:none;background-color:rgb(0,0,0);position:fixed;width:" + breedte + "px;height:" + hoogte + "px;border:solid 0px;'></div>");

         document.write("<div id='" + divid + "' style='position:fixed;z-index:11110;display:none;width:" + breedte + "px;height:" + hoogte + "px;border:solid 1px;' onclick='javascript:sehidelightwindowimage();'>");
         document.write("<div id='afdek' style='cursor:pointer;position:fixed;z-index:11115;width:" + breedte + "px;height:" + hoogte + "px;border:solid 0px;' onclick='javascript:sehidelightwindowimage();'>");
         document.write("<img id='afdekimg' onmousedown='right();' onmouseup='right();' src='images/spacer.gif' border='0' width='" + breedte + "' height='" + hoogte + "'/></div>");
         document.write("<div id='sluitvak' style='cursor:pointer;position:absolute;width:25px;height:25px;background-color:Gray;' onclick='javascript:sehidelightwindowimage();'>");
         document.write("<img src='images/min.gif' border='0' />");
         document.write("</div>");
         document.write("<div id='downRGB' style='line-height:22px;z-index:11120;margin-left:26px;cursor:pointer;position:absolute;width:120px;height:25px;background-color:Gray;'>");
         document.write("&nbsp;<a href='/downloadImage.ashx'>Download rgb</a>");
         document.write("</div>");
         
         //document.write("<div id='orderCMYK' style='line-height:22px;z-index:11125;margin-left:147px;cursor:pointer;position:absolute;width:120px;height:25px;background-color:Gray;'>");
        // document.write("&nbsp;<a href='orderform'>&nbsp;Order CMYK</a>");
         //document.write("</div>");
         
         document.write("<img id='imgchanger' src='/images/spacer.gif' border='0'/>");
         document.write("</div>");
         
         var browser=navigator.appName;
         var b_version=navigator.appVersion;
         var version = parseFloat(b_version);

       if (searchVersion(navigator.appVersion) == 6){
         document.getElementById(divid).style.position = "absolute";
         document.getElementById('blackback').style.position = "absolute";
         document.getElementById('afdek').style.position = "absolute";
       }
    }
}


function hideDownloadlinks(){
    document.getElementById('downRGB').style.display = "none";
     document.getElementById('downRGB').style.visibility = "hidden"; 
    document.getElementById('orderCMYK').style.display = "none";
     document.getElementById('orderCMYK').style.visibility = "hidden"; 
}


  function searchVersion(dataString) {
        // eenvoudige functie om ie te identificeren
		var index = dataString.indexOf('MSIE');
		if (index == -1) return;
		return parseFloat(dataString.substring(index+'MSIE'.length+1));
	}
	
function seshowvergrootglas(divid){
     document.getElementById(divid).style.display = "block";
     document.getElementById(divid).style.visibility = "visible"; 
}

function sehidevergrootglas(divid){
     document.getElementById(divid).style.display = "none";
     document.getElementById(divid).style.visibility = "hidden"; 
}

function resizeblackback(){
  
    var frame = document.getElementById("blackback");  
    var htmlheight = document.body.parentNode.scrollheight;  
    var windowheight = window.innerheight;  
           
        if ( htmlheight < windowheight ) 
        { 
            document.body.style.height = windowheight + "px"; 
            frame.style.height = windowheight + "px"; 
        }  else { 
            document.body.style.height = htmlheight + "px"; 
            frame.style.height = htmlheight + "px"; 
        }
    
  
}

function seshowlightwindowimage(divid, breedte, hoogte)
{
     screenz = segetWindowSize();
     scrollz = segetScrollXY();
        
     lastlightwindowdiv = divid;
     
     document.getElementById('blackback').style.display = "block";
     document.getElementById('blackback').style.visibility = "visible"; 
     document.getElementById('blackback').style.left = 0 + "px";
     document.getElementById('blackback').style.top = 0 + "px";
     document.getElementById('blackback').style.width = (screenz[0]) + "px";
      
     document.getElementById('blackback').style.height = (screenz[1]) + "px";
     
     document.getElementById(divid).style.display = "block";
     document.getElementById(divid).style.visibility = "visible"; 
     document.getElementById(divid).style.left = ((screenz[0] - breedte)/2)  + "px";
 
     document.getElementById(divid).style.top = (((screenz[1]-hoogte)/2))  + "px";
     document.getElementById(divid).style.width = breedte + "px";
     document.getElementById(divid).style.height = hoogte + "px";
     

     
}

function sehidelightwindowimage(divid)
{
 
     document.getElementById(lastlightwindowdiv).style.display = "none";
     document.getElementById(lastlightwindowdiv).style.visibility = "hidden"; 
     document.getElementById('blackback').style.display = "none";
     document.getElementById('blackback').style.visibility = "hidden"; 
     
}

var lasterrorstr = "";
function rewriteOnerror(props)
{
    lasterrorstr = props;
}

 function sechangeimageslide(name, pad, downFotopad, hideDownlinks)
 {
    obj = document.getElementById("imgchanger");
    
    if (obj == null) return; 
    
    if (lasterrorstr == "")
    {
        obj.name = name; 
    }
    else
    {
        obj.name = lasterrorstr; 
    }
    
    obj.onerror = sehandleErr;
    obj.src = pad;
    obj.onmousedown = right;
    obj.onmouseup = right;
    
    lastobj = obj;
    
    downdiv = document.getElementById("downRGB");
    downdiv.innerHTML = "&nbsp;<a href=\"/downloadImage.ashx?naam=foto.jpg&pad=" + downFotopad + "\" class=\"whitelink\">" + downlinkname + "</a>";
    
    //cmykdiv = document.getElementById("orderCMYK");
    //cmykdiv.innerHTML = "&nbsp;<a href=\"/page.aspx?id=2844&pad=" + downFotopad + "\" class=\"whitelink\">" + orderlinkname + "</a>";
    
    if (hideDownlinks == 'hide')
    {
        hideDownloadlinks();
    }
}
  
  
//var downFotopad = "";
//var fotonaam = "";
function setVars(pdownFotoid)
{
    alert('hier');
    downFotopad = pdownFotoid;
    //fotonaam = pfotonaam;
}
  
function sehandleErr()
{

  try
  {
     
      if (lastobj != null){
        seAfbeeldingError(lastobj);
      }else{

      }
  }
  catch(err)
  {
      txt="There was an error on this page.\n\n";
      txt+="Error description: " + err.description + "\n\n";
      txt+="Click OK to continue.\n\n";
      
  }


}


