function Toggle(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")  
   if (visible) {
     obj.style.display="none";
   } else {
      obj.style.display="block";
   }
}

function Show(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")  
   if (!visible) {
     obj.style.display="block";
   }
}

function Hide(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")  
   if (visible) {
     obj.style.display="none";
   }
}

function show(item) {
   obj=document.getElementById(item);
      obj.style.display="block";
}

var newwin;
function sizedWindow(url, width, height)
{
	//launch a new window and then focus it if window.focus() is supported.
	newwin = window.open(url,"TechnicPopup","location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width +",height=" + height + ",left=200,top=100,screenX=200,screenY=100");
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}

function fixedSizedWindow(url, width, height)
{
	//launch a new window and then focus it if window.focus() is supported.
	newwin = window.open(url,"TechnicPopup","location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width +",height=" + height + ",left=200,top=100,screenX=200,screenY=100");
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}	

function fixedWindow(url, width, height)
{
	//launch a new window and then focus it if window.focus() is supported.
	newwin = window.open(url,"TechnicPopup","location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + width +",height=" + height + ",left=200,top=100,screenX=200,screenY=100");
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}	

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=650,left=200,top=100,screenX=200,screenY=100')
}

function popupWindowPrice(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no')
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function swapinfo(imgName,img,imgClass) {
  document.images[imgName].src=img;
  document.images[imgName].className=imgClass;
}

function changeCase(frmObj) {
	var index;
	var tmpName;
	var tmpStr;
	var mytmpStrA;
	var mytmpStrB;
	var mytmpStrC;
	var mytmpStrD;
	var finalStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;

	tmpName = frmObj.name;	
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
		for (index = 0; index < strLen; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else {
				tmpChar = tmpStr.substring(index, index+1);
				if (tmpChar == " " && index < (strLen-1))  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
				}
			}
		}
	}
	mytmpStrA = tmpStr.replace(/\bSw\b/i, "SW");
	mytmpStrB = mytmpStrA.replace(/\bSe\b/i, "SE");
	mytmpStrC = mytmpStrB.replace(/\bNw\b/i, "NW");
	mytmpStrD = mytmpStrC.replace(/\bNe\b/i, "NE");
	mytmpStrE = mytmpStrD.replace(/\bPo\b/i, "P.O.");
	mytmpStrF = mytmpStrE.replace(/P.o./g, "P.O.");
	mytmpStrG = mytmpStrF.replace(/\bAfb\b/i, "AFB");

	if ( (tmpName == "firstname") || (tmpName == "lastname") || (tmpName == "city") ) {
	   if (!isLetters(mytmpStrG)) {
		finalStr = mytmpStrG.replace(/[^a-z ]/gi, "");
	   } else {
		finalStr = mytmpStrG;
	   }
	} else {
		finalStr = mytmpStrG;
	}

	frmObj.value = finalStr;
}

function lowerCase(frmObj) {
	var tmpStr;
	tmpStr = frmObj.value.toLowerCase();
	frmObj.value = tmpStr;
}

function upperCase(frmObj) {
	var tmpStr;
	tmpStr = frmObj.value.toUpperCase();
	frmObj.value = tmpStr;
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];

	if (input.value.length >= len && !containsElement(filter,keyCode)) 
	{
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function containsElement(arr, ele) 
	{
		var found = false, index = 0;
	
		while(!found && index < arr.length)
		if(arr[index] == ele)
			found = true;
		else
			index++;
			
		return found;
	}
	function getIndex(input) 
	{
		var index = -1, i = 0, found = false;
		
		while (i < input.form.length && index == -1)
			if (input.form[i] == input)
				index = i;
			else 
				i++;
				
		return index;
	}
	return true;
}

function seo_string(thestring) {

  var seostring = thestring.replace(/[^0-9a-z ]/gi, "");
  seostring = seostring.replace(/\s\s/g, " ");
  seostring = seostring.replace(/\s/g, "-");

  return seostring;

}
