
//common.js
//Shared script
 //Switch the following in/out for local and web operation of intra-site links

// withAbsoluteLinks "file:///C|/Documents and Settings/Peter/Desktop/Documents/abicsite/HTML/"  
//withAbsoluteLinks "http://www.netpublish.net/abictest/" 
// 
//initialize


home_link = '| Home | ';
ww_link = 'Workwear | ';
corp_link = 'Corporate/Office | ';
safety_link = 'Safety | ';
footware_link = 'Footware & Accessories | ';
sizing_link = 'Sizing | ';
contact_link = 'Contact |'
 
 
function writeFooterLink(chead,thead,clink,chover,cshort)
{
if (chead != thead)
 d.write('&nbsp;<a href="'+clink+'" title="' + chover + '">' + cshort+ '</a>&nbsp;|');
 else {d.write('&nbsp;<span class="selected">' + cshort + '</span>&nbsp;|')}
}
 
//footer text for all pages
function makeFooter(thead)
{
d.write('<DIV id="footercontent">');
d.write("|"); 
//
writeFooterLink("Welcome to ABIC Workwear",thead,"http://www.abicworkwear.com.au/index.html","Our home page","Home");
//
writeFooterLink("Workwear",thead,"http://www.abicworkwear.com.au/Workwear.html","Overalls, work casuals, wash &amp; wear, drill cotton","Workwear");
//
writeFooterLink("Office &amp; Casual Wear",thead,"http://www.abicworkwear.com.au/OfficeCasualWear.html","Woven shirts, jackets, polos","Office/Casual");
//
writeFooterLink("Safety Wear",thead,"http://www.abicworkwear.com.au/SafetyWear.html","High visibilitiy and protective clothing, head, eye and ear protection, etc&nbsp;","Safety");
//
writeFooterLink("Footwear and Accessories",thead,"http://www.abicworkwear.com.au/FootwearAccessories.html","Boots, shoes, socks","Footwear");
//
writeFooterLink("Promotional",thead,"http://www.abicworkwear.com.au/Promotional.html","Caps, bags and other promotional items&nbsp;","Promotional");
//
writeFooterLink("Sizing",thead,"http://www.abicworkwear.com.au/Sizing.html","Guide to clothing and shoe sizes","Sizing");
//
writeFooterLink("Price List",thead,"http://www.abicworkwear.com.au/PriceList.html","General price list","Prices");
//
writeFooterLink("Orders and Enquiries",thead,"http://www.abicworkwear.com.au/OrdersandEnquiries.html","Send an enquiry or place an order from the site","Contact");
//
writeFooterLink("Suppliers’ Sites",thead,"http://www.abicworkwear.com.au/SuppliersSites.html","Links to websites of our suppliers","Suppliers");
//
writeFooterLink("SPECIALS January – February 2010",thead,"http://www.abicworkwear.com.au/SpecialsJanFeb10.html","","Specials");
//
d.write('</div>');
writeModDate(thead);
//d.write('<br />Website by <a href="http://www.netpublish.net" title="netpublish.net website design and development services" target="_blank">Peter Bloxsom</a>
//| <a href="index.html">Home</a> | Workwear | Corporate/Office | Safety | Footwear & Accessories | Sizing | Contact | 
//
}//End makeFooter function


function writeModDate(thead)
{
//Write last mod date
credit=''; if (thead=='Welcome to ABIC Workwear') credit = 'Site development by <a href="http://www.netpublish.net" target="_blank" title="netpublish website design and development">Peter Bloxsom</a>&nbsp;&nbsp;&nbsp;';
mdate = getModDate(); 
document.write('<div id="moddatediv">' + credit + 'Page last modified: ' + mdate + '</div>');
}


function xref()
{ 
if (clicks >= 1) {alert("Sorry, you can't go anywhere by clicking there, just 'mouse over' the acronym or term to see a definition.")} else {clicks ++}
}


function frameBust() 
{
	if (self.parent.frames.length != 0)
	self.parent.location=document.location;
}


function nowt()
{
//dummy function
}
//
 	
// Picture-swapping 

function rollIn(imgName, divid)
{
if (document.layers && divid != null)
	{	
var divObject=document[divid];
divObject.document[imgName].src = eval(imgName +"_on.src")
	}
else
      document[imgName].src=eval(imgName + "_on.src");
}

function rollOut(imgName,divid)
{
if (document.layers && divid != null)
	{	
divObject=document[divid];
divObject.document[imgName].src = eval(imgName +"_off.src")
	}
else
      document[imgName].src=eval(imgName + "_off.src");
 }

//

function showDiv(divID)
{
 if (isIE4up)
	{
		var divStyle = document.all.item(divID).style;
		divStyle.visibility = "visible"
 	}
		else if (isNS6up)
		{
		var divObject = document.getElementById(divID);
		divObject.style.visibility = "visible"
		}
		else if (isNS4up)
		{
		var divObject = document.layers[divID];
		divObject.visibility = "show"
		}
}

function hideDiv(divID)
{
 if (isIE4up)
	{
		var divStyle = document.all.item(divID).style;
		divStyle.visibility = "hidden"
 	}
		else if (isNS6up)
		{
		var divObject = document.getElementById(divID);
		divObject.style.visibility = "hidden";
		}
		else if (isNS4up)
		{
		var divObject = document.layers[divID];
		divObject.visibility = "hide"
		}
}


 


//
function assembleText(content)	
{
output="<html><head><title>Popup Text</title>";
output += "<style>body {font-family: Verdana, Geneva, Arial, Helvetica, Sans-serif; font-size: 11px; color: #000099} P {margin-top: 2px; margin-right:2px; margin-bottom:8px; margin-left:2px} H3 {font-size: 12px; margin-top: 2px; margin-right:2px; margin-bottom:7px; margin-left:2px; text-align:center}";
output += "A:link {background-color:transparent;color:#0000FF; text-decoration : underline}"
output+= "A:hover {background-color: transparent; color: #CCCC00; text-decoration: underline}</style></head>";
output +="<body bgcolor='#FFFFEE' >";
output +=  content + "<p align='right'><a href='javascript:window.close()'>Close window</a></p></body></html>";
return output;
}
//onBlur='javascript:window.close()'

var winObject = null; 
var winObj = null; //Use as last param in js popupBig() links
//popupBig() returns

function popupBig(image,caption,wheight,winObject)
{
status="";
output="<html><head><title>" +caption + "</title>";
output += "<style>body {font-family: Verdana, Geneva, Arial, Helvetica, Sans-serif; font-size: 11px; color: #000099; margin-top: 0px; margin-right:0px; margin-bottom:0px; margin-left:0px}";
output += "P: margin:2px; padding:0px"
output += "A:link {background-color:transparent;color:#0000FF; text-decoration : underline}"
output+= "A:hover {background-color : transparent; color : #F0C000; text-decoration : underline}</style></head>";
output +="<body bgcolor='#FFFFFF'>";
output +=  '<center><img src="' +image + '"><br clear="all" /></center><a href="javascript:window.close()">Close window</a></body></html>';

windowOptions = "directories=0,toolbar=0,menubar=0,status=0,scrollbars=1,resizable=1,";
windowOptions += "width=400,height=" + wheight + ",top=0,left=396";
 if (winObject != null)
  {
    // the window has already been created, but did the user close it?
    // if so, then reopen it. Otherwise make it the active window and resize it.
   if (!winObject.closed) 
    {
      winObject.focus();
	  winObject.resizeTo (400,wheight);
    } 
   else winObject=window.open("","popupbig",windowOptions);
    
   }
 else 
   {
    winObject=window.open("","popupbig",windowOptions);
   }
// 
	winObject.document.open();
	winObject.document.write(output);
	winObject.document.close();
	winObj = winObject; 
//return winObj
}

function popupText(output)
{
 textWindow=window.open("","popuptxt","width=148,height=180,top=1,left=630,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
//
if (textWindow != null) //window opened successfully
	{
	textWindow.document.open();
	textWindow.document.write(output);
	textWindow.document.close();
	}
else alert("Unable to open popup window. You may need to close other applications or windows to free up some memory, then try again."); 	
}

// Popup text 
function popupFile(fileURL,top,height,left,width) 
{
 windowOptions = "directories=1,menubar=1,personalbar=0,status=1,scrollbars=1,resizable=1,";
 windowOptions += "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left;
 window.open(fileURL,"popwindow",windowOptions)
}

function popupEbook(fileURL,top,height,left,width) 
{
 windowOptions = "directories=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0,";
 windowOptions += "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left;
 window.open(fileURL,"popwindow",windowOptions)
}


function popupFull(url)
//Full window
{
 fullWindow=window.open(url,"popupfull","left=0,top=0,width=780,resizable,height=565,scrollbars,toolbar, status");
// 
}

function popupURL(fileURL) 
//Use for Glossary
{
glossWindow=window.open(fileURL,"popwindow3","left=460,top=0,width=330,height=560, resizable,scrollbars")
//if (Opr4) glossWindow.reload;
}


// Function showModDate: display the last mod date for the current file
function getModDate(dateText)
{
mm = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September", "October",
"November", "December");
update = new Date(document.lastModified);
//Use last mod date if processed, otherwise param or literal  
if ((update.getYear()) == "70")
	{if (dateText=="") revdate = "6 March 2002";
	else revdate = dateText;
	}
else 
	{
	dayOfMonth = update.getDate();
	revdate = dayOfMonth + " ";	
	revdate +=  mm[update.getMonth()]+" ";
	theyear = (update.getYear());
if (theyear<1900) theyear+=1900;
	revdate += theyear;
	}
return revdate
}
	
// Display today's date
function todayDate()
{
dw = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ); 
m = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");  
today = new Date(); day = today.getDate();
//
//thedate = (d[today.getDay()]+" ");
thedate = day + " ";
thedate += m[today.getMonth()]+" ";
theyear = today.getYear();
if (theyear < 1900) theyear += 1900;
thedate += theyear;
return thedate;
}


function setMenuMarker(i)
{

markerobj = gE("menumarker");
hE(markerobj); //hide

	switch(i) 
	{
	case "1" : vpos="187px";break;    
	case "2" : vpos="210px";break;
	case "3" : vpos="233px";break;
	case "4" : vpos="256px";break;
	case "5" : vpos="279px";break;
	case "6" : vpos="302px";break;
	case "7" : vpos="325px";break;
	case "8" : vpos="348px";break;
	case "9" : vpos="371px";break;
	case "10" : vpos="394px"; break;
	default : return;   
	} 

sY(markerobj,vpos); sE(markerobj); //position and show
}


function checkEmail(checkString)
{
    var newstr = "";
    var at = false;
    var dot = false;

    // DO SOME PRELIMINARY CHECKS ON THE DATA

    // IF EMAIL ADDRESS HAS A '@' CHARACTER
    if (checkString.indexOf("@") != -1) {
      at = true;

    // IF EMAIL ADDRESS HAS A '.' CHARACTER
    } else if (checkString.indexOf(".") != -1) {

      dot = true;
    }
    // PARSE REMAINDER OF STRING
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    if ((at == true) && (dot == true)) {
        //document.form.realname.value = document.form.firstname.value + " " + document.form.lastname.value; 
		return true;
    }
    else {
      // DISPLAY ERROR MESSAGE
      alert ("Sorry, the email address you entered is invalid!");
      return false;
    }

}

function writeEmail(name,domain,screenLetters) {
   visible=(typeof(screenLetters)=="undefined")? name+"@"+domain : 
screenLetters;
   document.write ('<a href=mailto:'+name+'@'+domain+'>'+visible+'</a>');
}

