function popImage(imageURL) {
        var opt='scrollbars=no,width=150,height=100,left=100,top=100';
        imgWin = window.open('','',opt);
        with (imgWin.document) {
                writeln('<html><head><title>...</title><style type="text/css">body {overflow: auto; margin: auto; margin:0; padding: 0;}</style>');
                writeln('<sc'+'ript type="text/javascript">');
                writeln('function resizePopup() {');
                writeln('width = document.images[0].width + 10; ');
                writeln('height = document.images[0].height + 30; ');
                writeln('window.resizeTo(width,height); ');
                writeln('if (window.innerWidth) { window.innerWidth = width - 10; window.innerHeight = height - 30; }');
                writeln('}');
                writeln('</s' + 'cript>');
                writeln('</head><body bgcolor="#000000" onload="resizePopup();">')
                writeln('<img src="'+imageURL+'" onclick="window.close();" border="0" style="position: absolute; left: 0px; top: 0px; cursor: pointer;"/></body></html>');
                close();
        }
}

function popImage2(imageURL) {

        var opt='scrollbars=yes,resizable=yes,width=150,height=100,left=100,top=100';
        imgWin = window.open('','',opt);
        with (imgWin.document) {
                writeln('<html><head><title>...</title><style type="text/css">body {overflow: auto; margin: auto; margin:0; padding: 0;}</style>');
                writeln('<sc'+'ript type="text/javascript">');
                writeln('function resizePopup() {');
                writeln('width = document.images[0].width + 10; ');
                writeln('height = document.images[0].height + 30; ');
                writeln('window.resizeTo(width,height); ');
                writeln('if (window.innerWidth) { window.innerWidth = width - 10; window.innerHeight = height - 30; }');
                writeln('}');
                writeln('</s' + 'cript>');
                writeln('</head><body bgcolor="#000000" onload="resizePopup(); reloadIt();">')
                writeln('<img src="'+imageURL+'" onclick="window.close();" border="0" style="position: absolute; left: 0px; top: 0px; cursor: pointer;"/></body></html>');
                close();
        }
}

function opendoc2(docURL, w, h) {
 var opt='scrollbars=yes,toolbar=no,status=no,menubar=no,width='+w+',height='+h+',left=100,top=100';
 imgWin = window.open(docURL,'',opt);
}

function popupPrintPreview(carId) {
        var opt='scrollbars=no,width=850,height=700,left=100,top=100,menubar=1,toolbar=1,titlebar=1,scrollbars=1';
        previewWin = window.open('../print_preview.php?type=1&car_id=' + carId,'',opt);
}



//image popup layer
var imageLayVisible=0;	
function showImage(element, imageURL) {
			if (imageLayVisible!=1) {
				imageLink=element.innerHTML;
                element.innerHTML=imageLink+'<span style="position: absolute;"><img src="'+imageURL+'" style="position: absolute;left: 100px;top:100px;border: 1px solid #000000;"/></span>';
				imageLayVisible=1;
			}
}

function hideImage(element) {
		element.innerHTML=imageLink;
		imageLink='';
		imageLayVisible=0;
		if (element.outerHTML) {
			element.outerHTML=element.outerHTML;
		}
}