/* scripts.js, VERSION: 1.1, COPYRIGHT NEXIVUS, LLC 30 APR 07 */



//allows multiple onload calls
function addLoadListener(fn){
 if (typeof window.addEventListener != 'undefined'){
   window.addEventListener('load', fn, false);
 }
 else if (typeof document.addEventListener != 'undefined'){
   document.addEventListener('load', fn, false);
 }
 else if (typeof window.attachEvent != 'undefined'){
   window.attachEvent('onload', fn);
 }
 else{
   var oldfn = window.onload;
   if (typeof window.onload != 'function'){
     window.onload = fn;
   }
   else{
     window.onload = function(){
       oldfn();
       fn();
     };
   }
 }
}
function showadd(id){
	if (pedazo==1){
		if (window.hbar2){window.clearTimeout(hbar2);}
		new Rico.Effect.FadeTo(id, 0, 1, 1,'');
		$(id).style.display='block';
		new Rico.Effect.FadeTo(id, 1, 300, 6,'');
		hbar2 = setTimeout(function () {new Rico.Effect.FadeTo(id, 0, 300, 6,{complete:function() {$(id).style.display='none';}});},5000);
	}
}
function showbar(id){
	if (pedazo==1){
		if (window.hbar){window.clearTimeout(hbar);}
		new Rico.Effect.FadeTo(id, 0, 1, 1,'');
		$(id).style.display='block';
		new Rico.Effect.FadeTo(id, 1, 300, 6,'');
		hbar = setTimeout(function () {new Rico.Effect.FadeTo(id, 0, 300, 6,{complete:function() {$(id).style.display='none';}});},5000);
	}
}
function hidebar(id){
	if (window.hbar){window.clearTimeout(hbar);}
	hbar = setTimeout(function () {new Rico.Effect.FadeTo(id, 0, 300, 6,{complete:function() {$(id).style.display='none';}});},1000);
}
function lgin(sid,ci){
	//var chkt=($('rmb'+sid)).checked?1:0;//if remember is implemented ever;doesn't do anything righ now
	var chkt = 0;
	if ($('usr'+sid).value != '' && $('pwd'+sid).value != ''){
		ajaxEngine.registerRequest('lguser'+sid, 'cms/action_others.cfm');
		ajaxEngine.registerAjaxElement('p'+sid);
		document.body.style.cursor="wait";
		var cfm = "vars=login^"+$('usr'+sid).value+"^"+$('pwd'+sid).value+"^"+chkt+"^"+ci+"^"+sid;
		var options = {onComplete:function () {window.location.reload(false);},method:'post', parameters:cfm };
		ajaxEngine.sendRequest('lguser'+sid, options);			
	}
	else {
		alert('You must enter a valid username and password.')
		$('usr'+sid).focus();
	}
}
function logout(){
	ajaxEngine.registerRequest('lout', 'cms/action_others.cfm');
	ajaxEngine.registerAjaxElement('responsediv');
	var cfm = "vars=logout";
	var options = {onComplete:function () {window.location.reload(false);},method:'post', parameters:cfm };
	ajaxEngine.sendRequest('lout', options);
}
