
window.addEvent('domready', function() {
	findRollovers();
	inputAlt();
});
function videoloading() {
	v = document.getElementById('player');
	v.innerHTML='<div style="height:200px;width:240px;border:1px solid #C2C8C4;vertical-align:middle;text-align:center;">loading...</div><br /><br />';
}
function sendReq(thiss,query,targettID) {
	if(thiss!='' && thiss!=null)
		thiss.blur();
	vars = {
		url: '/postBack.php',
		method: 'post',
		data: query
	}
	if(targettID && targettID!='bypass')
		vars.update=targettID;
	new Request.HTML(vars).send();
}
function findRollovers() {
	var i = 1;
	var o = {};
	var _o = {};
	$$('img').each(function(e) {
		if(e.hasClass('rollover')) {
			e.setStyle('cursor','pointer');
			e.index = i;
			ext = e.src.substring(e.src.length-3);
			stub = e.src.substring(0,e.src.length-4);
			o[i] = new Element('img',{src:e.src});
			_o[i] = new Element('img',{src:stub+'_o.'+ext});
			e.addEvent('mouseover',function(e) {this.src = _o[this.index].src;});
			e.addEvent('mouseout',function(e) {this.src = o[this.index].src;});
			i++;
		}
	});
}
function inputAlt()
{
	$$('input').each(function(e){
		if(e.type=='text' && e.alt)
		{
			e.value = e.alt;
			e.addEvent('focus',function(){if(this.value==this.alt) this.value=''});
			e.addEvent('blur',function(){if(this.value=='') this.value=this.alt});
		}
	});
}

/********************************
 standard functions
********************************/

function showHide(obj) {
	if ( document.getElementById(obj).style.display=='' )
		document.getElementById(obj).style.display='none';
	else
		document.getElementById(obj).style.display='';
}
function pop(thiss,url,width,height) {
	if(thiss!='')
		thiss.blur();
	win = window.open(url,'pop'+height+width,'toolbar='+( width==750 ? 'yes' : 'no' )+',width='+eval(width+20)+',height='+height+',directories=no,status=no,scrollbars=yes,resizable=yes,menubar='+( width==750 ? 'yes' : 'no' )+',left=150,top=60,titlebar=no');
	win.focus();
	return false;
	void(0);
}
		function submitForm(thiss,formID,query,returnID) {
			if(typeof formID == "object")
				formID=formID.id;
			if(thiss)
				if(!validate(thiss,formID)) 
					return false;
				
				getstr = 'q=formSubmit&formID='+formID+'&'+query+'&';
				fme = document.getElementById(formID).elements;
				for (i=0; i<fme.length; i++) {
				switch(fme[i].tagName) {
					case("INPUT"):
							if (fme[i].type == "text" || fme[i].type == "hidden") {
								v = fme[i].value;
								if(v!='')
									v = format4db(v);
								getstr += fme[i].name + "=" + v + "&";
							}
							if (fme[i].type == "checkbox") {
								if (fme[i].checked)
									getstr += fme[i].name + "=" + fme[i].value + "&";
								else
									getstr += fme[i].name + "=0&";
							}
							if (fme[i].type == "radio") {
								if (fme[i].checked)
									getstr += fme[i].name + "=" + fme[i].value + "&";
							}
						break;
					case("SELECT"):
							sel = fme[i];
							//alert(sel.name+' = '+sel.options[sel.selectedIndex].value);
							getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
						break;
					case("TEXTAREA"):
							txranm = fme[i].name;
							txra = fme[i].value;
							if(txra!='')
								txra = format4db(txra);
							getstr += txranm + "=" + txra + "&";
						break;
					}
				}
						//	alert('sending query back to: '+returnID);
				sendReq(thiss,getstr,returnID);
			
		}
		function format4db(txt) {
			txt = txt.replace(/&/g,"_xxxx");
			txt = txt.replace(/\?/g,"_qqqq");
			txt = txt.replace(new RegExp('/"/g'),"_qpqpqp");
			txt = txt.replace(/\+/g,"_pppp");
			//txt = txt.replace(/\'/g,"''");
			return txt;
		}
