function ShowHideElement(Id) {
    var Element = document.getElementById(Id)
    if (Element.style.display == 'block') {
        Element.style.visibility = 'hidden';
        Element.style.display = 'none';
    } else {
        Element.style.display = 'block';
        Element.style.visibility = 'visible';
    }
}

function CheckInputNumeric() {
    alert('event:' + event.keyCode);
    //alert(KeyCode);
    //if (KeyCode < 45 || KeyCode > 57) {
        //alert('detected');
        //event.returnValue = false;
    //}
}

function ChangeImage(Name,SRC) {
	document.images[Name].src=SRC;
	return true;
}

// Error document.parentWindow has no properties
function ChangeWS(WS) {
//  parent.parentWindow.status = WS;
	//document.parentWindow.status = WS;
	return true;
}

function PrintScreen(){
	return window.print();
	return true;
}

function ChangeMainFrame(SRC){
	parent.MainFrame.location.href = SRC;
}

function ChangeLeftFrame(SRC){
	parent.LeftFrame.location.href = SRC;
}

function ChangeTopFrame(SRC){
	parent.TopFrame.location.href = SRC;
}

function ChangeStatus(SRC){
	parent.BottomFrame.location.href = 'Bottom.asp?Windowstatus=' + SRC;
	return true;
}

function InfoScherm(lngPartijID,strSoort,strCode,lngVoorraad,dblPrijs)   {
    window.open('Info.asp?PID=' + lngPartijID +'&S=' + strSoort +'&CODE=' + strCode + '&VOOR=' + lngVoorraad + '&PRIJS=' + dblPrijs,'New','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,dependent=no,screenX=0,screenY=0,fullscreen=no,type=Window,width=350,height=550');
}

function FotoScherm(lngPartijID,strSoort,strCode,lngVoorraad,dblPrijs)   {
    window.open('Foto.asp?PID=' + lngPartijID +'&S=' + strSoort +'&CODE=' + strCode + '&VOOR=' + lngVoorraad + '&PRIJS=' + dblPrijs,'New','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,dependent=no,screenX=0,screenY=0,fullscreen=no,type=Window,width=400,height=400');
}

function Validate(fForm, sField)
{
	var sFormFieldValue = 'fForm.' + sField + '.value'
	sInput = eval(sFormFieldValue)
				
	var iInvalidIndex = -1
	var sQuote = unescape('%27')
				
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf(sQuote)}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf(';')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('?')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf(',')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('$')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('+')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('-')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('&')}
	if (iInvalidIndex == -1) {iInvalidIndex = sInput.indexOf('*')}
				
	if (iInvalidIndex != -1) {
		alert("Sorry, character not allowed.");
		iLength = sInput.length - 1 
		var sAction = sFormFieldValue + ' = ' + sFormFieldValue + '.substring(0,' + iLength + ')'					
		eval(sAction)
		}				
}

///////////////////////////////////////////////////////////////////////////////////////////
// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 600;
defaultHeight = 400;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

	function WinOpen(imageURL,imageTitle){
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>' + imageTitle + '</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
				writeln('isNN=(navigator.appName=="Netscape")?1:0;');
				writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
				writeln('if (isIE){');
					writeln('window.resizeTo(100,100);');
					writeln('width=100-(document.body.clientWidth-document.images[0].width);');
					writeln('height=100-(document.body.clientHeight-document.images[0].height);');
					writeln('window.resizeTo(width,height);}');
				writeln('if (isNN){');       
					writeln('window.innerWidth=document.images["George"].width;');
					writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('</sc'+'ript>');

	if (!AutoClose) 
   		writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();self.focus()">')
		else 
		writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
	close();		
}}

//function blockError(){return true;}
//window.onerror = blockError;
