function oRoll(img)
{
	var x=(img.prevSrc?0:1);
	img.src=img.src.replace(/_\d/,"_"+x);
	img.prevSrc=x;
}
function openWindow(url, width, height, type, winName) {
	var paramStr="";
	if (type=="console") {
		paramStr="resizable,height="+height+",width="+width;
	} else if (type=="fixed") {
		paramStr="status,height="+height+",width="+width;
	} else if (type=="content") { // fixed size with scrolling
		paramStr="scrollbars,status,height="+height+",width="+width;
	} else if (type=="normal") { // a normal window but with width & height set
		paramStr="status,toolbar,menubar,scrollbars,resizable,location,height="+height+",width="+width;
	} else if(!type || type=="flexible") { // default
		paramStr="scrollbars,resizable,height="+height+",width="+width;
	}
	if(!winName) { // make unique but consistent window name for this page
		winName = 'myWin_'+url.substr(0,url.indexOf("?")).replace(/\W/g,"");
	}
	winObj = window.open(url, winName, paramStr);
	winObj.focus();
	return winObj;
}
function openContact() {
	openWindow( 'http://www.bluemarmot.com/contact.php?ws=drp', '350', '475', 'console' );
}
var currL;
var winObj;
function openLargeView(id,l) {
	if(winObj) { winObj.close(); }

	if(l==1) {
		winObj=openWindow( 'large_view.phtml?id='+id, '500', '400', 'console' );
	} else {

		winObj=openWindow( 'large_view.phtml?id='+id, '400', '500', 'console' );
	}
}
function openDetail(id) {
	openWindow( 'detail_view.phtml?id='+id, '200', '200', 'console' );
}
function extSite(url) {
	openWindow( url, 550, 400, 'normal' );
}
function openGWT()
{
	openWindow( 'about_gwt.phtml',650,500 )
}
function openPrivacy() {
	openWindow( 'http://www.bluemarmot.com/privacy.phtml?ws=drp', 450, 480);
}

var clickmessage="This image is copyrighted. Please contact me for permission to use."

var PIMG = "main_img";
function disableclick(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
			if (event.srcElement.id==PIMG){
				alert(clickmessage);
				return false;
			}
		}
	}
	else if (document.layers) {
		if (e.which == 3) {
			alert(clickmessage);
			return false;
		}
	}
	else if (document.getElementById){
		if (e.which==3&&e.target.id==PIMG){
			alert(clickmessage)
			return false
		}
	}
}

function init_p() {
	if (document.all)
		document.onmousedown=disableclick
	else if (document.getElementById)
		document.onmouseup=disableclick
	else if (document.layers)
		document.images[PIMG].onmousedown=disableclick;
}
