//***************************************************************
// Utility Scripts for Skatebuys
//***************************************************************

// to link this file to an HTML page, insert the following code within the HEAD tags:
// <script language="JavaScript" type="text/javascript" src="http://www.skate-buys.info/utils.js"></script>


// build dynamic page (no actual page needs to exist on the file system)
function viewLarger(src,title,w,h) {
	var rootDir = "http://www.skate-buys.info/images/";
	
	/*
	var OpenWindow = null;
	if(OpenWindow && !(OpenWindow.closed)) {
		alert('Window is open')
	} else {
		alert('Window is closed')
	}
			
	if((w == "") || (w == null))
		w = "570";
	if((h == "") || (h == null))
		h = "500";
	*/
	//OpenWindow = window.open("", "newwin", "width=570, height=500");
	OpenWindow = window.open("", "newwin", "width=" + w + ", height=" + h + ",resizable=1");
	OpenWindow.document.write("<html><title>" + title + "</title>");
	OpenWindow.document.write("<body style='margin:0px;font: 9pt arial, helvetica, sans-serif'>");
	OpenWindow.document.write("<div align='center'>");
  	OpenWindow.document.write("<img src='" + rootDir + src + "'><br>");
	OpenWindow.document.write("<p style='font-weight:bold'>" + title + "</p>");
	OpenWindow.document.write("<a href='javascript:close()'>Close Window</a><br>");
	OpenWindow.document.write("</div></body></html>");
	OpenWindow.document.close()
	self.name="main"
	OpenWindow.resizeTo(w,h)
	OpenWindow.focus()
	
}

function viewLargerscroll(src,title,w,h) {
	var rootDir = "http://www.skate-buys.info/images/";
	OpenWindow = window.open("", "newwin", "width=" + w + ", height=" + h + ",resizable=1,scrollbars=1");
	OpenWindow.document.write("<html><title>" + title + "</title>");
	OpenWindow.document.write("<body style='margin:0px;font: 9pt arial, helvetica, sans-serif'>");
	OpenWindow.document.write("<div align='center'>");
  	OpenWindow.document.write("<img src='" + rootDir + src + "'><br>");
	OpenWindow.document.write("<p style='font-weight:bold'>" + title + "</p>");
	OpenWindow.document.write("<a href='javascript:close()'>Close Window</a><br>");
	OpenWindow.document.write("</div></body></html>");
	OpenWindow.document.close()
	self.name="main"
	OpenWindow.resizeTo(w,h)
	OpenWindow.focus()
	
}


// open window function
function newWin(url, w, h) {
var rootDir = "http://www.skate-buys.info/images/";
	if (!window.Win || Win.closed)
	    var Win = window.open(rootDir + url,"displayWindow",'width=' + w + ',height=' + h + ',resizable=1,scrollbars=0,toolbar=0' );
	else
		Win.location = rootDir + url;
		Win.focus();
}

// alternate open window function
function newWin2(url,w,h) {
	var rootDir = "http://www.skate-buys.info/images/";
	objNewWin = window.open("","win",'status=1,scrollbars=0,resizable=1,width=' + w + ',height=' + h);
	objNewWin.location = rootDir + url;
	objNewWin.focus();
}

