//form popup function

function form_popup(element_id) {
	document.getElementById(element_id).target = '_blank';
	return true;
}

function show2(area_id) {
	document.getElementById('submenu_' + area_id).className="show";
	document.getElementById('button_' + area_id).className= "active";	
}

function hide2(area_id) {
	document.getElementById('submenu_' + area_id).className="hide";
	class_name = document.getElementById('button_' + area_id).className;
	url = location.href;
	if(url.indexOf(area_id) == -1) document.getElementById('button_' + area_id).className="";
}


// Begin Image Preload Function

var preloaded = new Array();
var images = new Array();

function preload() { 
	for(i=0; i<preload.arguments.length; i++) {
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src', preload.arguments[i]);
	}
}

images[0]="company";
images[1]="services";
images[2]="products";
images[3]="contact";
images[4]="customer";
images[5]="news";

for(i=0; i<6; i++) {
	preloaded[i] = document.createElement('img');
	preloaded[i].setAttribute('src', '/demo/images/button_' + images[i] + '_dk.gif');
}

function validatePageSearch(go_to) {
	if(Trim(document.getElementById('q').value) != "") {
		window.location = go_to + '?q=' + document.getElementById('q').value;
	} else {
		alert('Please complete all required fields.');
		document.getElementById('q').focus();
	}

	return false;
}

function Trim(STRING){
	STRING = LTrim(STRING);
	return RTrim(STRING);
}

function RTrim(STRING){
	while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
	}
	return STRING;
}


function LTrim(STRING){
	while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
	}
	return STRING;
}