var strPath = "";

////////////////////////////////////////////////////
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var popupWin ;				// Used ty OpenWin and other pages to detect if a pop-up blocking is on.
var imgPreLoad = false;		// used by change image
var jsTime = "01234567890";
//---------------------------- Begin Window Open Template ---------------------------- //
// Open a pop-up window
function OpenWin()
{
	// Set default values
	var winName = "newWin";
	var intWd = 500;
	var intHt = 500;
	var intXPos = -1;
	var intYpos = -1;

	var bTool = 'yes';
	var	bLoc = 'yes';
	var bStatus = 'yes';
	var bMenu = 'yes';
	var bScroll = 'yes';
	var bResize = 'yes';
	var bHist = 'no';
	
	var strProp = "";  // Properties of the opened window
	
	// If there are no arguaments passed to the function then use the above defaults.
	
	if (OpenWin.arguments[0]){
		var url = OpenWin.arguments[0];
	
		if (OpenWin.arguments[1])
			winName = OpenWin.arguments[1];
		
		if (OpenWin.arguments[2])
			intWd = OpenWin.arguments[2];
			
		if (OpenWin.arguments[3])
			intHt = OpenWin.arguments[3];
	
		if (OpenWin.arguments[4])
			intXPos = OpenWin.arguments[4];
			
		if (OpenWin.arguments[5])
			intYpos = OpenWin.arguments[5];
			
		if (OpenWin.arguments[6])
			bTool = OpenWin.arguments[6];
			
		if (OpenWin.arguments[7])
			bLoc = OpenWin.arguments[7];
			
		if (OpenWin.arguments[8])
			bStatus = OpenWin.arguments[8];
			
		if (OpenWin.arguments[9])
			bMenu = OpenWin.arguments[9];
			
		if (OpenWin.arguments[10])
			bScroll = OpenWin.arguments[10];
			
		if (OpenWin.arguments[11])
			bResize = OpenWin.arguments[11];
			
		if (OpenWin.arguments[12])
			bHist = OpenWin.arguments[12];
			
		if (intXPos < 1 ) 
		  if (window.screenLeft ) 
			intXPos = window.screenLeft + 20;
		  else
			intXPos = 20;

		if (intYpos < 1) 
		  if ( window.screenTop ) 
			intYpos = window.screenTop - 10;
		  else
			intYpos = 10;
	
		strProp = '';
		strProp	= strProp + "toolbar=" + bTool + ",location=" + bLoc + ",status=" + bStatus + ",menubar=" + bMenu + ","
		strProp	= strProp + "scrollbars=" + bScroll + ",resizable=" + bResize + ",copyhistory=" + bHist + ",";
		strProp	= strProp + "width=" + intWd + ",height=" + intHt + ",left=" + intXPos + ",top=" + intYpos + "";

		popupWin = window.open(url, winName,strProp);
		popupWin.focus();  // Place focus on new window
	}
	else
	{
		alert("Please provide the URL.")
	}
}
//---------------------------- End Window Open Template ---------------------------- //

function openWindow(url){
	OpenWin(url,'theWindow',740,500,-1,-1);
}


//---------------------------- BEGIN Form Basics ---------------------------- //
function strTrim(str) {
	//Match spaces at beginning and end of text and replace
	//with null strings
	return str.replace(/^\s+/,'').replace(/\s+$/,'');
	}
	
//-- Menu Drop Downs
sfHover = function() {
	if (document.getElementById && document.getElementById("nav") != null)
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}

}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// Standard Rollover image
//---------------------------- Change Images ---------------------------- //
function changeImagesByID(imgID, imgSwap)
{ 
	if (document.images && imgPreLoad )
	{
		//alert('Name: ' + imgID + '\n' +eval(imgSwap + ".src"));
		var obj = null;
		
		if (document.getElementById)
		{
			obj = document.getElementById(imgID);
		}  else if (document.layers){
			obj = document.layers[imgID];
		}
		if (obj !=null)
			obj.src = eval(imgSwap + ".src");
	}
}

function changeImages()
{ 	if (document.images && imgPreLoad )
	{
   		for (var i=0; i<changeImages.arguments.length; i+=2)
   		{
			document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
   		}
	}
}
//---------------------------- Show / Hide ---------------------------- //
// Show or hide an element , and swap image
//-------------------------------------------------------------	
function showHideObj(name){
	var obj;
		if (document.getElementById)
		{
			obj = document.getElementById(name);
		}  else if (document.layers){
			obj = document.layers[name];
		}
		
		if (obj.style.display == "none"){
			obj.style.display = "block";
			}
		else{
			obj.style.display = "none";
			}
			
}
// Show Element
function showObj(name){
	var obj;
		if (document.getElementById)
		{
			obj = document.getElementById(name);
		}  else if (document.layers){
			obj = document.layers[name];
		}
		
		obj.style.display = "block";
}

// Hide Element
function hideObj(name ){
	var obj;
		if (document.getElementById)
		{
			obj = document.getElementById(name);
		}  else if (document.layers){
			obj = document.layers[name];
		}
		
			obj.style.display = "none";			
}
//------------------------------------------------------------------------ //


function changeContentByID(objID, strText)
{
		var obj = null;
		
		
		if (document.getElementById)
		{
			obj = document.getElementById(objID);
		}  else if (document.layers){
			obj = document.layers[objID];
		}
		
		if (obj !=null)
			obj.innerHTML = strText;

}


/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
		
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox

//------------------------------------------------------------------------ //


if(document.images)
{
	// on Home Page images
	imgHome_on = new Image();
	imgHome_on.src = strPath + "/images/nav_home_on.gif";

	imgHome_off = new Image();
	imgHome_off.src = strPath + "/images/nav_home_off.gif";
	
	imgArticles_on = new Image();
	imgArticles_on.src = strPath + "/images/nav_articles_on.gif";

	imgArticles_off = new Image();
	imgArticles_off.src = strPath + "/images/nav_articles_off.gif";
	
	imgContact_on = new Image();
	imgContact_on.src = strPath + "/images/nav_contact_on.gif";

	imgContact_off = new Image();
	imgContact_off.src = strPath + "/images/nav_contact_off.gif";
	
	imgService_on = new Image();
	imgService_on.src = strPath + "/images/nav_service_on.gif";

	imgService_off = new Image();
	imgService_off.src = strPath + "/images/nav_service_off.gif";
	
	imgPortfolio_on = new Image();
	imgPortfolio_on.src = strPath + "/images/nav_portfolio_on.gif";

	imgPortfolio_off = new Image();
	imgPortfolio_off.src = strPath + "/images/nav_portfolio_off.gif";
	
	imgPreLoad = true;

}