function formClear(){
	
	var inp=document.getElementsByTagName('input');
	
	for(var i=0;i<inp.length;i++){
		
		if(inp[i].type=='text'){
			
			inp[i].setAttribute('rel',inp[i].defaultValue)
			inp[i].onfocus=function(){
				
				if(this.value==this.getAttribute('rel')){
					this.value='';
				}else{
					
					return false;
					
				}
			
			}
			
			inp[i].onblur=function(){
				
				if(this.value==''){this.value=this.getAttribute('rel');
				
				} else{
					
					return false;
					
				}
			}
			
			inp[i].ondblclick=function(){this.value=this.getAttribute('rel')
			
			}
		}
	}
}


function submitForm(f){
	if(window.XMLHttpRequest){
		var xmlReq = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		var xmlReq = new ActiveXObject('Microsoft.XMLHTTP');
	}
	var formData = '', elem = '';
	for(var s=0; s<f.elements.length; s++){
		elem = f.elements[s];
		if(formData != ''){
			formData += '&';
		}
		formData += elem.name+"="+elem.value;
		}
		xmlReq.onreadystatechange = function(){
		if(xmlReq.readyState == 4){
			document.getElementById('messageconfirm').innerHTML = xmlReq.responseText;
		}
	}
	xmlReq.open(f.method, f.action, true);
	xmlReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlReq.send(formData);
return false;
}

function swapImage(tab,image){
	
	if (!document.getElementById){ return; }
	
	var target_tab = document.getElementById(tab);
	var target_butn = document.getElementById(image);
	
	target_tab.style.backgroundPosition = "-51px 0px";
	target_butn.style.backgroundPosition = "0px -23px";
	
}

function restore(tab,image){
	
	if (!document.getElementById){ return; }
	
	var target_tab = document.getElementById(tab);
	var target_butn = document.getElementById(image);
	
	target_tab.style.backgroundPosition = "0px 0px";
	target_butn.style.backgroundPosition = "0px 0px";
	
}

function rollover(){

	if (!document.getElementsByTagName){ return; }
	
	var anchors = document.getElementsByTagName("a");

	for (var i=0; i<anchors.length; i++){
		
		var anchor = anchors[i];

		if (anchor.getAttribute("rel") == "rollover"){
			
			target = (anchor.getAttribute('class')) ? anchor.getAttribute('class'): anchor.getAttribute('classname');
						
			if(target == 'tab_ec'){
				
				anchor.onmouseover = function () { swapImage('tab_ec', 'butn_ec'); }
				anchor.onmouseout = function () { restore('tab_ec', 'butn_ec'); }
			
			} else if(target == 'tab_ew'){
			
				anchor.onmouseover = function () { swapImage('tab_ew', 'butn_ew'); }
				anchor.onmouseout = function () { restore('tab_ew', 'butn_ew'); }
			
			} else if(target == 'tab_cl'){
			
				anchor.onmouseover = function () { swapImage('tab_cl', 'butn_cl'); }
				anchor.onmouseout = function () { restore('tab_cl', 'butn_cl'); }
			
			} else if(target == 'tab_sg'){
			
				anchor.onmouseover = function () { swapImage('tab_sg', 'butn_sg'); }
				anchor.onmouseout = function () { restore('tab_sg', 'butn_sg'); }
			
			}
			
		}
	}
}

//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//
function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}



addLoadEvent(rollover);	// run initLightbox onLoad
addLoadEvent(formClear);	// run formClear onLoad
