﻿function checklen(box,maxlen,note){
    pass = true;
    note.value = box.value.length + " of " + maxlen;
    if(box.value.length > maxlen){
        var txt = box.value;
        box.value = txt.substring(0,maxlen);
        pass = false;
        alert("You have reached the max character count for this field.\n");
        note.value = box.value.length + " of " + maxlen;
    }
    if (window.event){
        window.event.returnValue = pass;
        return pass;
    }
}

//ROLLOVERS
var timeout = 500;
var closetimer = null;
var subclosetimer = null;
var ddmenu = null;
var ddsubmenu = null;

function rollOn(section){
    // CANCEL CLOSE TIMER
    menuCancelCloseTime();
    
    if(ddmenu) ddmenu.style.display = 'none';
    
    // GET NEW LAYER AND SHOW IT
    ddmenu = document.getElementById(section);
    ddmenu.style.display = 'block';
}

function clearMenu(){
    if(ddmenu) ddmenu.style.display = 'none';
}

function rollOnDiv(item){
    menuCancelCloseTime();
}

// GO CLOSE TIMER
function menuCloseTime(){
    closetimer = window.setTimeout(clearMenu, timeout);
}

// CANCEL CLOSE TIMER
function menuCancelCloseTime(){
    if(closetimer){
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}

function rollOnItem(section){
	var obj = document.getElementById(section);
		
	obj.style.backgroundColor='#012D52';
}

function rollOffItem(section){
	var obj = document.getElementById(section);
		
	obj.style.backgroundColor='';
}

//FLASH
function createParam(nameStr, valueStr) {
	var el = document.createElement('param');
	el.setAttribute('value', valueStr);
	el.setAttribute('name', nameStr);
	return el;
}

function loadFlash(){
	var obj = document.createElement('object');
	
	document.getElementById("divscrolltext").appendChild(obj);
	
	obj.type = "application/x-shockwave-flash";
	obj.movie = "/includes/scrolltext.swf";
	obj.data = "/includes/scrolltext.swf";
	obj.width = "600";
	obj.height = "190";
	obj.id = "scrolltext";
	obj.name = "scrolltext";
	obj.scale = "noborder";
	obj.wmode = "transparent";
	obj.menu = "false";
	obj.loop = "true";
	
	obj.appendChild(createParam('wmode', 'transparent'));
	obj.appendChild(createParam('menu', 'false'));
	obj.appendChild(createParam('loop', 'true'));
}

window.onload = function(){
    loadFlash();
}
