//--- startup ------------------------------------

function startup() {
	frameBreaker();
	checkRes();
}

//--- Image Mouseover ----------------------------------

var base_nav = "/pics/nav/";
var outArr = new Array();
var overArr = new Array();
var imgArr = new Array('home','services','products','contact','sendsms','dirmap','form','login','logout');

// preload
if (document.images) {
	// preload nav
	for (i=0; i < 4; i++) {
		outArr[i] = new Image;
		outArr[i].src = base_nav + imgArr[i] + "_off.gif";
		overArr[i] = new Image;
		overArr[i].src = base_nav + imgArr[i] + "_on.gif";
	}

	// preload other
	outArr[4] = new Image;
	outArr[4].src = "/pics/contact/sendsms_off.gif";
	overArr[4] = new Image;
	overArr[4].src = "/pics/contact/sendsms_on.gif";
	outArr[5] = new Image;
	outArr[5].src = "/pics/contact/dirmap_off.gif";
	overArr[5] = new Image;
	overArr[5].src = "/pics/contact/dirmap_on.gif";
	outArr[6] = new Image;
	outArr[6].src = "/pics/contact/form_off.gif";
	overArr[6] = new Image;
	overArr[6].src = "/pics/contact/form_on.gif";
	outArr[7] = new Image;
	outArr[7].src = "/pics/stockmanager/login_off.gif";
	overArr[7] = new Image;
	overArr[7].src = "/pics/stockmanager/login_on.gif";
	outArr[8] = new Image;
	outArr[8].src = "/pics/stockmanager/logout_off.gif";
	overArr[8] = new Image;
	overArr[8].src = "/pics/stockmanager/logout_on.gif";
}

function over(n) {
	if (document.images)
		document.images[imgArr[n]].src = overArr[n].src;
}

function out(n) {
	if (document.images)
		document.images[imgArr[n]].src = outArr[n].src;
}

//--- Div Mouseover ----------------------------------

function divSwap(obj, new_style, type) {
	if (type == "class")
		obj.className = new_style;
	else if (type == "id")
		obj.id = new_style;
}

//--- Frame Breaker -----------------------------
// Reload site if loaded in an external frameset

function frameBreaker() {
	if (top.location != self.location)
		top.location.href = self.location.href;
}

//--- Screen resolution -----------------------------

function checkRes() {
	if ((screen.width < 780) || (screen.height < 550))
		alert("Please note: Our site is optimized for a Screen Resolution of 800x600 or larger. Please adjust your settings before continuing for optimal viewing.");
}

//--- Popup windows ----------------------------------

function popwin1(url,name,w,h) {  // no scrollbars, not resizable
	var winW = (screen.width - w) / 2;
	var winH = (screen.height - h) / 2;
	window.open(url,name,'width='+w+',height='+h+',top='+winH+',left='+winW+',toolbar=no,location=no,directories=no,menubar=no,status=yes,scrollbars=no,resizable=no');
}
