var origHeight, origWidth;
var coll = "";
var styleObj = "";
var isMac, isPC;
if (navigator.platform.indexOf('Mac') != -1) {
	isMac = true;
} else {
	isPC = true;
}

if (document.layers) {
	origWidth = innerWidth;
	origHeight = innerHeight;
} else if (document.all) {
	coll = "all.";
	//styleObj = ".style";
} else if (document.getElementById) {
	coll = "getElementById('";
	//styleObj = "').style";
	styleObj = "')";
}

function fixLayer(lname) {
	var fixedLayer;
	if (document.layers) {
		fixedLayer = "document." + lname;
	} else if (document.all) {
		fixedLayer = "document.all." + lname;
	} else if (document.getElementById) {
		fixedLayer = "document.getElementById('" + lname + "')";
	}
	return fixedLayer;
}

function fixLayerLong(lname) {
	var fixedLayer;
	
	if (document.layers) {
		//alert("document." + lname);
		fixedLayer = eval("document." + lname);
	} else {
		//alert("document." + coll + lname + styleObj);
		fixedLayer = eval("document." + coll + lname + styleObj);
	}
	return fixedLayer;
}


function swap(image, over) {
	if (over) {
		document.images[image].src = document.images[image].src.replace(/_off/gi, '_over');
	} else {
		document.images[image].src = document.images[image].src.replace(/_over/gi, '_off');
	}
}

function swapIconLbl(imagesrc,over) {
	if (over) {
		document.images['icon_lbl'].src = imagesrc;
	} else {
		document.images['icon_lbl'].src = '/img/spacer.gif';
	}
}

function writeToLayer(layerName,layerText) {
  layerObj = fixLayerLong(layerName);
	
  if (document.layers) {
    with (layerObj) {
      document.write(layerText);
      document.close();
    }
  } else if (document.all) {
    layerObj.innerHTML = layerText;
  } else if (document.getElementById) {
    layerObj.innerHTML = layerText;
  }
}

function printWin(thisURL) {
	popWin= window.open(thisURL,"printWin", "width=600,height=500,scrollbars=1,resizable=1,menubar=1,toolbar=1");
	popWin.focus();
}

function emailWin(thisURL) {
	popWin = window.open('/utils/email.html?pageurl=' + thisURL, "emailWin", "width=650,height=500,scrollbars=1,resizable=1,menubar=1,toolbar=1");
	popWin.focus();
}

//<a href="javascript:rs('details','path_to_file',500,270,0,1)"></a>
var remote=null;
function rs(n,u,w,h,x,no) {
if ( no == 1 ) {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=no,scrollbars=no,status=0');
}
if ( no == 2 ) {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=1,scrollbars=1,menubar=1,location=1,toolbar=1,status=0');
}
else {
  remote=window.open(u,n,'width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=0');
}
if (remote != null) {
remote.focus();
if (remote.opener == null )
remote.opener = self;
}
if (x==1){return remote;}
}


function showStatus(sMsg) {
    window.status = sMsg ;
    return true ;
}

function option1(form,doc_name) 
	{
	//undate hidden ProductID field before posting
	form.ProductID.value = doc_name;
	document.theForm.submit();
	}
