/* Detects browser and redirects to the appropriate web page. */

function browserRedirect()
{
  var ns4 = document.layers;
  var ns6 = document.getElementById && !document.all;
  var ie4 = document.layers;
  var ie5 = document.getElementById && !document.all;
  
  if(ns4) URLStr = "non_xhtml_home.htm";
  else if(ie4) URLStr = "non_xhtml_home.htm";
  else if(ie5) URLStr = "main.html";
  else URLStr = "main.html";
  location = URLStr;
}

/* Browser Detection Info Script begins here. */
var theDOM1 = (document.getElementById) ? true : false;
/* theApp will contain the browser name */
var theApp = navigator.appName.toLowerCase();
/* UA (user agent) contains detailed browser info. For example,
UA for Internet Explorer on Mac would be 'mozilla/4.0 (compatible;
msie 5.0; mac_powerpc)' */
var UA = navigator.userAgent.toLowerCase();
/* variables for the two major browsers in existence today. */
var isIE = (UA.indexOf('msie') >= 0) ? true : false;
var isNS = (UA.indexOf('mozilla') >= 0) ? true : false;
/* 'compatible' text string is only in non-Netscape browsers */
if (UA.indexOf('compatible')>0){
isNS = false;
}
/* platform */
var thePlatform = navigator.platform.toLowerCase();
var isMAC = (UA.indexOf('mac') >= 0) ? true : false;
var isWIN = (UA.indexOf('win') >= 0) ? true : false;
/* Most UNIX users use X-Windows so this detects UNIX most of
the time.*/
var isUNIX = (UA.indexOf('x11') >= 0) ? true : false;
/* browser version */
var version = navigator.appVersion;
var isMajor = parseInt( version );
/* Internet Explorer version 5 on the Mac reports itself as version
4. This code corrects the problem. */
if(isIE && isMAC) {
if(UA.indexOf("msie 5")) {
isMajor = 5;
var stringLoc = UA.indexOf("msie 5");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}
}
/* Internet Explorer version 6 on Windows reports itself as version
4. This code corrects the problem. */
if(isIE && isWIN) {
if(UA.indexOf("msie 6")) {
isMajor = 6;
var stringLoc = UA.indexOf("msie 6");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}

if(UA.indexOf("msie 5.5")) {
isMajor = 5;
var stringLoc = UA.indexOf("msie 5.5");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}
}
/* Netscape 6 reports itself as version 5 on all platforms.
This code corrects the problem. */
if(isNS && isMajor>4) {
if(UA.indexOf("netscape6")) {
isMajor = 6;
var stringLoc = UA.indexOf("netscape6");
version = UA.substring(stringLoc + 10, stringLoc + 14);
}
}
var isMinor = parseFloat( version );
/* a function to report browser info */
function getBrowserInfo(){
var temp="<p>";
temp += "User Agent: " + UA + "<br>";
temp += "Platform: " + thePlatform + "<br>";
temp += "Macintosh: " + isMAC + "<br>";
temp += "Windows: " + isWIN + "<br>";
temp += "Application: " + theApp + "<br>";
temp += "Version: " + version + "<br>";
temp += "Netscape: " + isNS + "<br>";
temp += "Internet Explorer: " + isIE + "<br>";
temp += "Major Version: " + isMajor + "<br>";
temp += "Full Version: " + isMinor + "<br>";
temp += "<br>";
if (theDOM1){
temp += "You appear to have a modern browser.<br>";
temp += "Netscape 6, IE 6, or IE5Mac are recommended.";
}else{
temp += "Alert! Your browser is obsolete.<br>";
temp += "You may enjoy the Web more if you upgrade.";
}
temp +="<\/p>";
return temp;
}
/* End of browser detection code */


/* Convert object name string or object reference
into a valid object reference */
function getObj(elementID){
if (typeof elementID == "string") {
return document.getElementById(elementID);
}else{
return elementID;
}
}

/*This function places a positionable object (obj) in
three dimensions (x,y, and z).*/
function shiftTo(obj,x,y,z){
var newObj = getObj(obj);
newObj.style.left = x + "px";
newObj.style.top = y + "px";
newObj.style.zIndex = z;
}
/*This function gets the x coordinate of a positionable
object.*/
function getObjX(obj){
return parseInt(getObj(obj).style.left);
}
/*This function gets the y coordinate of a positionable
object.*/
function getObjY(obj){
return parseInt(getObj(obj).style.top);
}
/*This function gets the z-index of a positionable
object.*/
function getObjZ(obj){
return parseInt(getObj(obj).style.zIndex);
}
function shiftZTo(obj,x,y,z){
var newObj = getObj(obj);
newObj.style.left = x;
newObj.style.top = y;
newObj.style.zIndex = 1;
}

/*This function gets the available width of the window.*/
function getAvailableWidth(){
var theWidth=null;
/*Netscape uses window.innerWidth */
if (window.innerWidth) {
theWidth = window.innerWidth;
}
/*IE uses document.body.clientWidth */
if (document.body.clientWidth) {
theWidth = document.body.clientWidth;
}
return theWidth;
}
/*This function gets the available height of the window.
IE6.0 on Windows has a bug and returns null.*/
function getAvailableHeight(){
var theHeight = null;
/*Netscape uses window.innerHeight */
if (window.innerHeight) {
theHeight = window.innerHeight;
}
/*IE uses document.body.clientHeight */
if (document.body.clientHeight) {
theHeight = document.body.clientHeight;
}
return theHeight;
}
/*This function sets the total height and width of the
window.*/
function setWindowSize(w,h){
window.resizeTo(w,h);
}
/*This function sets the size of the window to cover all
of the screen.*/
function maximizeWindow(){
window.moveTo(0,0);
window.resizeTo(screen.availWidth,screen.availHeight);
}



/* Redirects visitors who are using outdated browsers.*/
function checkDOM(newlocation){
if (!theDOM1){
window.location.replace(newlocation);
}
}
/* This function changes the cursor.
The second argument is optional. */
function setCursor(cursortype,thisobj){
if (UA.indexOf("msie 5")>=0){
if (cursortype == 'pointer') { cursortype='hand'; }
}
if (thisobj==null){
document.body.style.cursor = cursortype;
}else{
getObj(thisobj).style.cursor = cursortype;
}
}
/*Set the background color of an object*/
function setBackground(thisobj, color){
getObj(thisobj).style.background = color;
}




/*Set the text color of an object*/
function setColor(thisobj, color){
getObj(thisobj).style.color = color;
}
/*Setting the visibility of an object*/
function setVisibility(obj,vis){
var theObj = getObj(obj);
if (vis == true || vis=='visible' || vis=='y'){
theObj.style.visibility = "visible";
}else{
theObj.style.visibility = "hidden";
}
}
/*Getting the visibility of an object*/
function isVisible(obj) {
var theObj = getObj(obj);
return theObj.style.visibility;
}


/*Setting the display of an object*/
function setDisplay(obj,dis){
var theObj = getObj(obj);
if (dis==true || dis=='block' || dis=='y'){
theObj.style.display = "block";
}else{
if (dis==false || dis=='n'){
theObj.style.display = "none";
}else{
theObj.style.display = dis;
}
}
}
/*Getting the display of an object*/
function isDisplayed(obj) {
var theObj = getObj(obj);
return theObj.style.display;
}

/*Set the clip region of an object*/
function setClip(obj,top,right,bottom,left){
var theObj = getObj(obj);
var r = 'rect('+top+'px,'+right+'px,'+bottom+'px,'+left+'px)';
theObj.style.clip = r;
}

var menuposition = "hidden";
var menuleft = -175;
var x = -175;
var y = 0;
var z = 1;
var delayrate=2;
var motionstep=20;
function togglemenu() {
var theclicker =getObj('menucontrol');
menuFX(theclicker,'out');
if (menuposition=="hidden"){
x=menuleft;
showmenu();
}else{
x=0;
hidemenu();
}
}
function hidemenu(){
if (x > menuleft){
x = x - motionstep;
(x < menuleft) ? x = menuleft : x=x;
shiftTo('slidemenu',x,y,z);
var timerID=setTimeout('hidemenu()',delayrate);
}else{
clearTimeout(timerID);
}
menuposition="hidden";
}
function showmenu(){
if (x < 0){
x=x + motionstep;
(x>0)?x=0:x=x;
shiftTo('slidemenu',x,y,z);
var timerID=setTimeout('showmenu()',delayrate);
}else{
clearTimeout(timerID);
}
menuposition="showing";
}
function menuFX(thisobj,theevent){
if (theevent=='over'){
setCursor("pointer","slidemenu");
setBackground(thisobj,"blue");
}else{
setCursor("auto","slidemenu");
setBackground(thisobj,"#00B5EF");
}
}

function triangle(elemID,theColor,flare){
var urlValue = "url(images/" + theColor + "triangle.gif)";
getObj(elemID).style.listStyleImage = urlValue;
bringForward(flare);
}
function bringForward(sample){
shiftTo('blank',0,0,12);
shiftTo('bwbc',0,0,11);
shiftTo('colorbc',0,0,10);
shiftTo('env',0,0,9);
shiftTo('lh',0,0,8);
shiftTo('rackcard',0,0,7);
shiftTo('calendar',0,0,6);
shiftTo('postcard',0,0,2);
shiftTo('forms',0,0,4);
shiftTo('copyserv',0,0,3);
shiftTo('samples',0,0,13);
}
var redtriangle = new Image;
redtriangle.src = "images/redtriangle.gif";

function processbid_forma()
{
bid_forma=document.forms["bidFormOne"]
if(bid_forma.name.value=="")
alert("You must fill in your name please!")
else
if(bid_forma.email.value=="")
alert("You must fill in your email please!")
else{
controlForm=parent.frames[1].document.controlForm
controlForm.name.value=bid_forma.name.value;
controlForm.city.value=bid_forma.city.value;
controlForm.state.value=bid_forma.state.value;
controlForm.email.value=bid_forma.email.value;

location.href="bid_formb.html"
}
}

function processbid_formb()
{
bid_formb=document.forms["bidFormTwo"]
controlForm=parent.frames[1].document.controlForm
controlForm.bc.value=bid_formb.bc.value;
controlForm.lh.value=bid_formb.lh.value;
controlForm.env.value=bid_formb.env.value;
controlForm.rack.value=bid_formb.rack.value;
controlForm.pstcrd.value=bid_formb.pstcrd.value;
controlForm.frms.value=bid_formb.frms.value;
controlForm.details.value=bid_formb.details.value;
location.href="thankyou.html"
}
