//opens pop-up browser window
var newwindow = '';
function popWin(url)  {
	if (!newwindow.closed && newwindow.location) { //is window already open?
		//yes, put new page into it
		newwindow.location.href = url; 
	}
	else {
	    // no, open new window
		newwindow=window.open(url,'_blank','height=440,width=625,left=100,location=no,menubar=no,toolbar=no,top=100,status=no');
		if (!newwindow.opener) newwindow.opener = self;
	}
	// put focus on new window
	if (window.focus) {newwindow.focus()}
	return false;
}

//Add to Picklist pop-up
var newwindow = '';
function popPicklist(url)  {
	if (!newwindow.closed && newwindow.location) { //is window already open?
		//yes, put new page into it
		newwindow.location.href = url; 
	}
	else {
	    // no, open new window
		newwindow=window.open(url,'_blank','height=500,width=800,left=100,location=no,menubar=no,toolbar=no,top=100,status=no,scrollbars=1');
		if (!newwindow.opener) newwindow.opener = self;
	}
	// put focus on new window
	if (window.focus) {newwindow.focus()}
	return false;
}


//RU site only: Add to Picklist pop-up
var newwindow = '';
function RUpopPicklist(url)  {
	if (!newwindow.closed && newwindow.location) { //is window already open?
		//yes, put new page into it
		newwindow.location.href = url; 
	}
	else {
	    // no, open new window
		newwindow=window.open(url,'_blank','height=200,width=500,left=100,location=no,menubar=no,toolbar=no,top=100,status=no,scrollbars=1');
		if (!newwindow.opener) newwindow.opener = self;
	}
	// put focus on new window
	if (window.focus) {newwindow.focus()}
	return false;
}

function popHelp(url) {
	newwindow=window.open(url,'FAQ','height=450,width=500,status=no,toolbar=no,resizable=1');
	var win_left = (screen.width - 500) / 5;
    var win_top = (screen.height - 450) / 5;
	newwindow.moveTo(win_top,win_left);
	if (window.focus) {newwindow.focus()}
	return false;
}

//CI Price Check pop-up
var winPrices = '';
function popPriceCheck(url)  {
	if (!winPrices.closed && winPrices.location) { //is window already open?
		//yes, put new page into it
		winPrices.location.href = url; 
	}
	else {
	    // no, open new window
		winPrices=window.open(url,'_blank','height=700,width=550,left=50,location=0,menubar=0,toolbar=0,top=50,status=0,scrollbars=1');
		if (!winPrices.opener) winPrices.opener = self;
	}
	// put focus on new window
	if (window.focus) {winPrices.focus()}
	return false;
}

function popHelp(url) {
	newwindow=window.open(url,'FAQ','height=450,width=500,status=no,toolbar=no,resizable=1');
	var win_left = (screen.width - 500) / 5;
    var win_top = (screen.height - 450) / 5;
	newwindow.moveTo(win_top,win_left);
	if (window.focus) {newwindow.focus()}
	return false;
}


// displays larged image... used on model and series pages et al

function popImage(imageURL,imageTitle){
// 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  = 645;
defaultHeight = 645;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

	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;
	
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</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(300,300);');
	writeln('width=300-(document.body.clientWidth-document.images[0].width);');
	writeln('height=300-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["prodImg"].width;');writeln('window.innerHeight=document.images["prodImg"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	
	if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	
	writeln('<img name="prodImg" src='+imageURL+' style="display:block"></body></html>');
	
	close();		
	}
}

