function popUp(w,h,URL) {
	popup = window.open(URL,'contact_info','titlebar=0,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h+'');
	popup.focus()
}

/***********************************************
* Switch Content script II- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="7" //persistence in # of days


/////No need to edit beyond here //////////////////////////

function getElementbyClass(rootobj, classname) {
	var temparray=new Array();
	var inc=0;
	var rootlength=rootobj.length;
	for (i=0; i<rootlength; i++){
	if (rootobj[i].className==classname)
	temparray[inc++]=rootobj[i]
}
	return temparray;
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){

//if (ccollect.length>0){
//alert("function called")

if(curobj.value == 1){
//show
document.getElementById(cid).style.display="none"
curobj.src=expandsymbol
}
else if (curobj.value == 2){
//hide
document.getElementById(cid).style.display= ""
curobj.src=contractsymbol
}
else{
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}
//}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) { 
	var search = Name + "="
	var returnvalue = "";
		if (document.cookie.length > 0) {
			offset = document.cookie.indexOf(search)
			if (offset != -1) { 
				offset += search.length
				end = document.cookie.indexOf(";", offset);
				if (end == -1){ 
					end = document.cookie.length;
				}
				returnvalue=unescape(document.cookie.substring(offset, end));
			}
		}
return returnvalue;
}

function getselectedItem(){
	if (get_cookie(window.location.pathname) != ""){
		selectedItem=get_cookie(window.location.pathname);
		return selectedItem;
	}
	else{
		//return "";
	}
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

//PreLoad secondary images
function preLoadImages(){
var t='<layer top="-100" left="0" visibility="hide"><div style="position:absolute; top:-100px; left:0px; visibility:hidden">';
for(i=0;i<arguments.length;i++)t+='<img src="'+arguments[i]+'" height="10" width="10">';
t+='</div></layer>';
document.write(t);
}

preLoadImages('/includes/images/submenu1_a_1_a.gif', '/includes/images/submenu1_na_1_a.gif');

function swapImage(imgN,imgU){
if(document.images)document.images[imgN].src=imgU;
}

// Format the phone field
// removes the leading and trailing spaces from a string,
// similar to the java.lang.String.trim() function
// added by lturetsky, taken from http://www.voy.com/1888/58.html
function trim(st) {
    var len = st.length
    var begin = 0, end = len - 1;
    while (st.charAt(begin) == " " && begin < len) {
        begin++;
    }
    while (st.charAt(end) == " " && begin < end) {
        end--;
    }
    return st.substring(begin, end+1);
}


function formatPhone (field) {
    field.value = trim(field.value);

    var ov = field.value;
    var v = "";
    var x = -1;

    // is this phone number 'escaped' by a leading plus?
    if (0 < ov.length && '+' != ov.charAt(0)) { // format it
        // count number of digits
        var n = 0;
        if ('1' == ov.charAt(0)) {  // skip it
            ov = ov.substring(1, ov.length);
        }

        for (i = 0; i < ov.length; i++) {
            var ch = ov.charAt(i);

            // build up formatted number
            if (ch >= '0' && ch <= '9') {
                if (n == 0) v += "(";
                else if (n == 3) v += ") ";
                else if (n == 6) v += "-";
                v += ch;
                n++;
            }
            // check for extension type section;
            // are spaces, dots, dashes and parentheses the only valid non-digits in a phone number?
            if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
                x = i;
                break;
            }
        }
        // add the extension
        if (x >= 0) v += " " + ov.substring(x, ov.length);

        // if we recognize the number, then format it
        if (n == 10 && v.length <= 40) field.value = v;
    }
    return true;
}


