 var RootPath = "/scn/";	
var UserDocs = "/scn.docs/users/1/";	
var DocRoot  = "scn.docs";	
var StringsMaxLenth  = 100000;
var SCN =  {
	settings : {
		RootPath : "/scn/",
		UserDocs: UserDocs,
		DocRoot: DocRoot,
		contentSelector: '.widget-content',
		contentUrl: ""+RootPath+"gadgets/"
		
		
		},/* Content Switcher inside a container*/
	SwitchItemsContainer: function (container,display,show){
		
		if(show){
		$('#'+container).show();
		}else{
		$('#'+container).hide();
		}
		$('#'+container).children().each( 
  function(){
	  if(display == this.id){
		  $('#'+display).show();
		  
	  }else{
		  $('#'+this.id).hide();
	  }
	 
  }
);
	},
	tools :     function(fieldid,action,vars){
	var values = $('#'+fieldid).val();
	//values = _SCN.ChkLenght(values,true)
SCN.CAnimate(fieldid,false,2);
$.post(""+RootPath+"js/scn.tools", {'do': action, 'var':vars,'vals':values}, function(data){
if(data){
if(data.length >0) {
$('#'+fieldid).val(data);
SCN.CAnimate(fieldid,true,2);
}
}
});
},
	
	 /*Cretit card Select */
	CreditCardSelect: function (sender,hidden,value,selectedcard){
var senderid = sender.id;
$('#'+selectedcard+'').html($('#'+senderid+'').html());
$('#icarditems').toggle(400);
$('#'+hidden+'').val(value);

}, /* form validate function*/
	ValidateField: function (field_,_message,_length){
	var field = $(''+field_+'').val();
		if(field.length<_length){
		SCN.MsgBox(_message);
		return false;
		}else{
		return true;
		}
		
		}, /* removes items by id or class*/
	RemoveItem: function (field){
		$(''+field+'').remove();
		
	
	}, /* alert function*/
	ValidateFields: function (fields_,_message,_length){
	var field = $(''+field_+'').val();
		if(field.length<_length){
		SCN.MsgBox(_message);
		return false;
		}else{
		return true;
		}
		
	}, /* alert function*/
	MsgBox: function (message,width,height){
	openMyModal(message,width,height,1);
	
	}, /* alert function default*/
	MsgBox: function (message){
	openMyModal(message,300,150,1);
	}, /* animate divs*/
	CFResult: function (Container,disable){
		if(disable){
			$("#"+Container+"_result").remove("slow");
			return false;
		}
		 div = $('<div id="'+Container+'_result" class="div_inner_animate_result_CF" style="height:20px;display:none;"></div>').addClass('inserted').attr('id', Container); 
		div.fadeIn("slow").prependTo(Container);

	}, /* animate divs*/
	CAnimate: function (Container,disable,Mode){
		
		if(disable){
			$("#"+Container+"_animate").remove("slow");
			$("#"+Container+"_result").remove("slow");
			return false;
		}

		var div = '';
		if(Mode==1){
		var container_h =  $("#"+Container).height();
		var container_w =	$("#"+Container).width();
		
		 div = $('<div id="'+Container+'_animate" class="div_inner_animate" style="width:'+container_w+'px;height:'+container_h+'px;display:none;"></div>').addClass('inserted').attr('id', Container+"_animate"); 
		}else if(Mode==2){
		div = $('<div id="'+Container+'_result" class="div_inner_animate_result_CF" style="height:20px;display:none;"></div>').addClass('inserted').attr('id', Container+"_result"); 
		}else{
		div = $('<div id="'+Container+'_result" class="div_inner_animate_result_CF" style="padding:10px 0px 10px 0px;display:none;"></div>').addClass('inserted').attr('id', Container+"_result"); 
		}
		div.fadeIn("slow").prependTo("#"+Container);

	}, /* changes checkboxes*/
	CheckboxToggle: function (main,name){
	if(main.checked == true){
$('input[name^="'+name+'"]').attr('checked', 'checked');
}else{
$('input[name^="'+name+'"]').removeAttr('checked');
}
	
	}, /* otions toggle*/
	toggleOptions: function (main,name){
	if($('input[name^="'+name+'"]').is(':checked'))  {
	alert("checked");
	}else{
	 alert(main.value);
	}
	
	},
	includ: function (e){
	SCN.include_js('/scn/js/hello.js','head');

	},
	include_js: function (jsname,pos) {
var th = document.getElementsByTagName(pos)[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',jsname);

s.onreadystatechange = function () {
		if (s.readyState == "loaded" || s.readyState == "complete")
{
	HELLO.malert();
}
	}
s.onload = function () {
	HELLO.malert();
	}
	
th.appendChild(s);
	
}, 
/* JSON TO GRAB CONTENT*/
	JSON: function(JsUrl,Container,limit){
var JsUrl = 'http://localhost/scn/__test/json_tutorial.php';
$.getJSON(JsUrl,
		function(data){
			var div = '';
		  $.each(data.items, function(i,item){
		 /*$("<div/>").attr("div", item.media.m).appendTo("#images");*/
		  div = $('<div>'+ SCN.JSONFormat(item) +'</div>').addClass('inserted').attr('id', Container+"_"+i); 
		  div.prependTo(Container);
		  });
		  
		});
	},
JSONFormat : function(items){
return items;
},
/* Href Replace*/
	href: function (urlid,newhref){
	$('#'+urlid).attr("href", newhref)
	
},/* Modal window*/
Modal: function (navUrl,width,height,action){
	openMyModal(navUrl,width,height,action);

},/* public Site Menu*/

	mainmenu: function (e){
var menuid = this.TopMenuName; 
JS("."+menuid+" ul ").css({display: "none"}); 
JS("."+menuid+" li").hover(function(){
JS(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(200);
		},function(){
		JS(this).find('ul:first').css({visibility: "hidden"});
		});
},/* public AJX*/

_AJX: function(forrmid,divplace,valor_id,secvar){
	var divplace;
	var loginelegido = document.getElementById(forrmid); 
	if(loginelegido){
	loginelegido = loginelegido.value;
	var forrmid = loginelegido;
	}
	var valor_id;
	var secvar;
	var responsers = "";
try{
$.get(""+RootPath+"js/scn.ajx", {'_u': divplace, '_p':loginelegido,'_id':valor_id,'_s': secvar}, function(data){
if(data){
if(data.length >0) {
$('#'+divplace).html(data);
$('#'+divplace).show();
if(data.indexOf("REDIR:")>=0){
 SCN._AJXREDIR(data);
}
}else{
$('#'+divplace).hide();
}
}else{
$('#'+divplace).hide();
}
});
}catch(e){
jQuery.get(""+RootPath+"js/scn.ajx", {'_u': divplace, '_p':loginelegido,'_id':valor_id,'_s': secvar}, function(data){
if(data){
if(data.length >0) {
jQuery('#'+divplace).html(data);
jQuery('#'+divplace).show();
if(data.indexOf("REDIR:")>=0){
 SCN._AJXREDIR(data);
}
}else{
jQuery('#'+divplace).hide();
}
}else{
jQuery('#'+divplace).hide();
}
});
}

},
_AJXREDIR :function(str){
var parenthesedText = /\|.*\|/;
var result = str.match(parenthesedText);
if(result){
s =new String(result);
s = s.replace("|","");
s = s.replace("|","");
setTimeout( "history.go()", s );
}

},
_AJX_animate : function (divplace,mode){
if(mode==true){
JS('#'.divplace).css("padding:","30px");
JS('#'.divplace).css("background","url(/scn/images/loading_small.gif) no-repeat top right");
}else{
JS('#'.divplace).css("padding:","0px");
JS('#'.divplace).css("background","none");
}
}
}


			function swapupgrades(username,formfield,mode,confDiv){
			var mode;
			var username;
			var formfield;
			var imputplacer = document.getElementById(formfield); 
			var infodiv = document.getElementById(confDiv); 
			infodiv.innerHTML='';
			if(mode==1){
			imputplacer.style.display='block';
			imputplacer.readOnly=true;
			imputplacer.value=''+username+'';
			infodiv.style.display='none';
			}else{
			imputplacer.readOnly=false;
			imputplacer.value='';
			infodiv.style.display='block';			
			}
			}
			function IsNumeric(input)
{
   return (input - 0) == input && input.length > 0;
}
function scn_reset_fields(_fields){
var arr_fields = _fields.split( "," );
for (i=0;i<arr_fields.length;i++){
$('input[@name='+arr_fields[i]+']').val(''); 
//$('#'+arr_fields[i]).val('');
}
}
function scn_chkbox_display(checkerbox,div){
var div_array = div.split(",");
var i=0; 
for (i; i<div_array.length; i++) { 
if(checkerbox.checked){
$('#'+div_array[i]).show();
}else{
$('#'+div_array[i]).hide();
}
}
}


function _toggle(sender, container){
$('#'+container).toggle(400);
}
function __autorep(from,towhere){
$('#'+towhere+'').html($('#'+from+'').val());
}
function _card_select(sender,hidden,value,selectedcard){
var senderid = sender.id;
$('#'+selectedcard+'').html($('#'+senderid+'').html());
$('#icarditems').toggle(400);
$('#'+hidden+'').val(value);
}
function _debug(content){
var contents = document.getElementById('sysdebug');
contents.innerHTML = contents.innerHTML + content;
contents.style.display='block';
}
function userlevelchec(usrid,formtype){
var Confirmation =  confirm("This option is only availeable for Non Free Users\n Upgrade Account?")
 if(Confirmation){
 window.location.href="?do=accountsupgrade.1&account_id="+usrid;
 } else{
return false;
 }  

}
function scrollme(position){
window.scrollBy(0,0);
}
function miflash(myurlff,anchoff,altoff,divid){
try{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + anchoff + '" height="' + altoff + '" name="'+divid+'" id="'+divid+'"swliveconnect="true"  align="middle">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="' + myurlff + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="swliveconnect" value="true" />');
	document.write('<embed src="' + myurlff + '" quality="high" bgcolor="#ffffff" wmode="transparent" width="' + anchoff + '" height="' + altoff + '" name="'+divid+'" id="'+divid+'" swliveconnect="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
	}catch(e){
	alert(e);
	}
	
}
function miMovie(myurlff,anchoff,altoff){
document.write('<embed src="/'+DocRoot+'/flash/vplay?v='+myurlff+'" width="'+anchoff+'" height="'+altoff+'" allowscriptaccess="always" allowfullscreen="true"  allowfullscreen="true" wmode="transparent"/>');
}
function miflashmovie(myurlff,anchoff,altoff){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + anchoff + '" height="' + altoff + '" align="middle">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="' + myurlff + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="scale" value="noscale" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="' + myurlff + '" quality="high" scale="noscale" bgcolor="#ffffff" wmode="transparent" width="' + anchoff + '" height="' + altoff + '" name="miflashmovie" id="miflashmovie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
	
}
function RadioCheck(obj,divplace,mode) {
var divplacer = document.getElementById(divplace); 
   if (obj.checked) {
   if(mode==1){
   divplacer.style.display='block';
   }else{
	divplacer.style.display='none';
   }
	  //alert("Already checked");
   }
}
function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
					 
	function _Unserialize(input)
	{
	
		var result = _Unserialize_(input);
	   
		return result[0];
	}

	function _Unserialize_(input)
	{
		var length = 0;
		
		switch (input.charAt(0)) {

			case 'a':
				length = _Unserialize_GetLength(input);
				input  = input.substr(String(length).length + 4);

				var arr   = new Array();
				var key   = null;
				var value = null;

				for (var i=0; i<length; ++i) {
					key   = _Unserialize_(input);
					input = key[1];

					value = _Unserialize_(input);
					input = value[1];

					arr[key[0]] = value[0];
				}

				input = input.substr(1);
				return [arr, input];
				break;

			case 'O':
				length = _Unserialize_GetLength(input);
				var classname = String(input.substr(String(length).length + 4, length));
				
				input  = input.substr(String(length).length + 6 + length);
				var numProperties = Number(input.substring(0, input.indexOf(':')))
				input = input.substr(String(numProperties).length + 2);

				var obj      = new Object();
				var property = null;
				var value    = null;

				for (var i=0; i<numProperties; ++i) {
					key   = _Unserialize_(input);
					input = key[1];
					
					// Handle private/protected
					key[0] = key[0].replace(new RegExp('^ ' + classname + ' '), '');
					key[0] = key[0].replace(new RegExp('^ \* '), '');

					value = _Unserialize_(input);
					input = value[1];

					obj[key[0]] = value[0];
				}

				input = input.substr(1);
				return [obj, input];
				break;

			case 's':
				length = _Unserialize_GetLength(input);
				return [String(input.substr(String(length).length + 4, length)), input.substr(String(length).length + 6 + length)];
				break;
			case 'i':
			case 'd':
				var num = Number(input.substring(2, input.indexOf(';')));
				return [num, input.substr(String(num).length + 3)];
				break;

			case 'b':
				var bool = (input.substr(2, 1) == 1);
				return [bool, input.substr(4)];
				break;

			case 'N':
				return [null, input.substr(2)];
				break;

			case 'o':
			case 'r':
			case 'C':
			case 'R':
			case 'U':
			   // alert('Error: Unsupported PHP data type found!');
			default:
				return [null, null];
				break;
		}
	}
	
	function _Unserialize_GetLength(input)
	{
		input = input.substring(2);
		var length = Number(input.substr(0, input.indexOf(':')));
		return length;
	}

function _AJX(forrmid,divplace,valor_id,secvar){
	var divplace;
	var loginelegido = document.getElementById(forrmid); 
	if(loginelegido){
	loginelegido = loginelegido.value;
	var forrmid = loginelegido;
	}
	//}
	var valor_id;
	var secvar;
	var responsers = "";
try{
$.get(""+RootPath+"js/scn.ajx", {'_u': divplace, '_p':loginelegido,'_id':valor_id,'_s': secvar}, function(data){
if(data){
if(data.length >0) {
$('#'+divplace).html(data);
$('#'+divplace).show();
if(data.indexOf("REDIR:")>=0){
 _AJXREDIR(data);
}
}else{
$('#'+divplace).hide();
}
}else{
$('#'+divplace).hide();
}
});
}catch(e){
jQuery.get(""+RootPath+"js/scn.ajx", {'_u': divplace, '_p':loginelegido,'_id':valor_id,'_s': secvar}, function(data){
if(data){
if(data.length >0) {
jQuery('#'+divplace).html(data);
jQuery('#'+divplace).show();
if(data.indexOf("REDIR:")>=0){
 _AJXREDIR(data);
}
}else{
jQuery('#'+divplace).hide();
}
}else{
jQuery('#'+divplace).hide();
}
});
}
}
function _toggle(divplace,values){
try{
$('#'+divplace).toggle(values);
}catch(e){
jQuery('#'+divplace).toggle(values);
}
}
	
function _AJXREDIR(str){
var parenthesedText = /\|.*\|/;
var result = str.match(parenthesedText);
if(result){
//alert(result);
s =new String(result);
s = s.replace("|","");
s = s.replace("|","");
//alert(s);
//result.replace(result,"}}");
setTimeout( "history.go()", s );

}
}
function Chkboxer(checkerbox,div){
if(checkerbox.checked){
document.getElementById(div).style.display="block"
}
else{
document.getElementById(div).style.display="none"
}
}			

function switcher(obj,imgs) {
var classe = document.getElementById(imgs);
var el = document.getElementById(obj);
if ( el.style.display != 'none' ) {
el.style.display = 'none';
if(classe){
classe.className = imgs;
}
}
else {
el.style.display = '';
if(classe){
classe.className = imgs+'_o';
}
}
}
function FlashpopUp(URL,wid,hei) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('"+URL+"', '" + id + "','toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width="+wid+",height="+hei+"');");
}

function VALME(valfield,   
			   cantlenth,
				mymode) 
{
	
var realvalue = document.getElementById(valfield).value;
 if(realvalue.length<cantlenth){
	return deactivate(valfield);

 }else{
  switch(mymode){
 case 'email':
 if (!VAL_EMAIL(realvalue)){
	return deactivate(valfield);
 }else{
 return activate(valfield);
 }
 break;
 case 'password':
 if (!VAL_PASSWORD(realvalue,5)){
	return deactivate(valfield);
 }else{
 return activate(valfield);
 }
 break;
case '':
 return activate(valfield);
 break;
}
}
}
function activate(valfield){
 document.getElementById(valfield).style.border = '1px solid #cccccc';
 document.getElementById(valfield).style.background = '#ffffff';
return true;
}

function deactivate(valfield){
document.getElementById(valfield).style.border = '1px solid #cc0000';
	document.getElementById(valfield).style.background = '#FFFFeC';
return false;
}
function myerrordiv(vardiv,mode,mytext){
try{
if(mode){
 document.getElementById(vardiv).style.display = 'block';
 document.getElementById(vardiv).innerHTML = mytext;
}else{
 document.getElementById(vardiv).style.display = 'none';
}
}catch (e)
{
alert(mytext);
return false;
}
}
function VAL_EMAIL(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(email) == false) {
	 alert('Invalid Email Address');
	  return false;
	  }else{
	  return true;
	  }
}
function VAL_PASSWORD(password,limit) {
   
   if(password.length<limit) {
	  return false;
	  }else{
	  return true;
	  }
}
function pay_selec(myvalue,divan,mitext,cvalue,citems,cmod,totaldiv,vartotals,wheredisc,disctot,paytype,typeid) {
var divan;
var mitext;
var cvalue;
var myvalue;
var citems;
var totaldiv;
var vartotals;
var wheredisc;
var disctot;
var paytype;
var typeid;
document.getElementById(divan).innerHTML = mitext;
document.getElementById(totaldiv).value = vartotals;
document.getElementById(wheredisc).value = disctot;
document.getElementById(myvalue).value = ''+cvalue+'';
document.getElementById(citems).value = ''+cmod+'';
document.getElementById(paytype).value = ''+typeid+'';
}
function getFlash() {
  if(navigator.appName.indexOf("Microsoft") != -1) {
			return window.getElementById("miflashmovie");
		} else {
			return document.getElementById("miflashmovie");
		}
	
}

function sendText() {
try{
	var flash = getFlash();
	flash.sendText();
	}catch(e){
	if(document.getElementById("flashanimation")){
	document.getElementById("flashanimation").style.display="none";
	document.getElementById("flashanimation").innerHTML="";
	}
	
	}
}
function fullpopup(page, windowname)
{
var yes = 1;
var no = 0;
var menubar = no; 
var scrollbars = yes; 
var locationbar = no; 
var directories = no;
var resizable = no;
var statusbar = no; 
var toolbar = no;
sendText();
if (navigator.appName == "Microsoft Internet Explorer"){ // better be ie6 at least
windowprops = "width=" + (screen.width-10) + ",height=" + (screen.height-30) + ",top=0,left=0";
}
else { // i.e. if Firefox
windowprops = "width=" + (screen.width-5) + ",height=" + (screen.height-30) + ",top=0,left=0";
}
windowprops += (menubar ? ",menubars" : "") +
(scrollbars ? ",scrollbars" : "") +
(locationbar ? ",location" : "") +
(directories ? ",directories" : "") +
(resizable ? ",resizable" : "") +
(statusbar ? ",status" : "") +
(toolbar ? ",toolbar" : "");
window.open(page, 'fullPopup', windowprops);
window.opener = top; 

}
function iefullpopup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, ',type=fullWindow,fullscreen,scrollbars=yes');
return false;
}

function chk_reserva(kidname,cardnumber,secc,noc,cm,cy,canti,ctype){

if (validate_required(kidname,"Please, Select a Child Name!!")==false){
kidname.focus();return false;
}else if(validate_required(cardnumber,"Please, Type your card number!!")==false){
cardnumber.focus();return false;
}else if(validate_required(secc,"The security code seems to be empty!!")==false){
secc.focus();return false;
}else if(validate_required(noc,"Please type name on card!!")==false){
noc.focus();return false;
}else if(validate_required(cm,"Please Type Card Expiration Month!!")==false){
cm.focus();return false;
}else if(validate_required(cy,"Please Type Card Expiration Year!!")==false){
cy.focus();return false;
}else if(validate_required(canti,"Please Select Subscription Type!!")==false){
canti.focus();return false;
}else if(validate_required(ctype,"Please Select Card Type!!")==false){
ctype.focus();return false;
 }else{
 document.getElementById('send_form').style.background = ' url('+RootPath+'/images/btn_loading.gif) #ff66cc no-repeat left middle';
document.getElementById('send_form').disabled = 'disabled';
document.getElementById('send_form').value = 'Processing Please Wait ...';
 document.enroll_form.submit();
 }

}
function chk_reservation(card_sel,cardnumber,secc,noc,cm,cy,canti,ctype,steps){

var steps;
if(validate_required(card_sel,"Please, Select a card type!!")==false){
card_sel.focus();return false;
}else if(validate_required(cardnumber,"Please, Type your card number!!")==false){
cardnumber.focus();return false;
}else if(validate_required(secc,"The security code seems to be empty!!")==false){
secc.focus();return false;
}else if(validate_required(noc,"Please type name on card!!")==false){
noc.focus();return false;
}else if(validate_required(cm,"Please Type Card Expiration Month!!")==false){
cm.focus();return false;
}else if(validate_required(cy,"Please Type Card Expiration Year!!")==false){
cy.focus();return false;
}else if(validate_required(canti,"Please Select Subscription Type!!")==false){
canti.focus();return false;
}else if(validate_required(ctype,"Please Select Card Type!!")==false){
ctype.focus();return false;
 }else{
 document.getElementById('send_form').style.background = ' url('+RootPath+'images/btn_loading.gif) #ff66cc no-repeat left middle';
document.getElementById('send_form').disabled = 'disabled';
document.getElementById('send_form').style.fontSize = '14px';
document.getElementById('send_form').value = 'Sending info\nPlease Wait ...';
brows_stp(steps,'_5');
 }

}

function validate_required(field,alerttxt)
{
with (field)
{
if (document.getElementById(field).value==null||document.getElementById(field).value=="")
  {alert(alerttxt);return false}
else {return true}
}
}
function validateFormx(form){
}
function brows_stp(optfrom,mode){
document.getElementById(optfrom).value=''+optfrom+''+mode;
var mivalor = document.getElementById(optfrom).value;
var chk_formas = validateFormx('enroll_form');
window.document.enroll_form.submit();

}
function chk_trmcond(reg_formname,reg_chkname,chk_value){

var reg_formname;
var reg_chkname;
var chk_value;
var prev_form;
var comprueba = document.getElementById(reg_chkname).checked;
if(comprueba!=true){
alert('Please click on the checkbox to accept the\nUser Registration Terms & Conditions');
return false;
}else{

window.document.prev_form.submit();
return true;
}
}
function chk_any(campos,modo,mensaje){
var campos;
var modo;
var mensaje;
switch(modo){
case '1':
var lugar = document.getElementById(campos).Value;
return false;
//}
alert(lugar);
//}
break
case '2':
var lugar = document.getElementById(campos).checked;
if(lugar!=true){
alert('Please select one of the '+mensaje+' options.');
return false;
}
break
default:
alert('NADA'+mensaje+' options.');
return true;
}
}


function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5) try { 
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
	} catch (e) { 
		try { 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (E) { 
			xmlhttp = false; 
		} 
	} @else xmlhttp = false; 
	@end 
	@*/  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp; 
} 
var http = getHTTPObject(); // We create the HTTP Object 
<!--
var nav4 = window.Event ? true : false;
function acceptNum(evt){
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
return (key == 95 || (key >= 48 && key <= 57) || (key >= 64 && key <= 90)|| (key >= 97 && key <= 121));

}
//-->

//
// MAIN JS
function DOBROWSER(){
var bresult='';
var agt=navigator.userAgent.toLowerCase();
if ( (parseInt(navigator.appVersion)==4) && 
	 (agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
			   && (agt.indexOf('compatible') == -1) ) {
var bresult ="mozilla";
}
else if (agt.indexOf('gecko') != -1) { 
var bresult ="gecko";
}
else if ( (parseInt(navigator.appVersion)>=4) && 
	 (agt.indexOf('msie') != -1) ) {
var bresult ="explorer";
}
//alert (btoa("test"));
//alert (bresult);
return bresult;
}

function encode64(input) {
//alert (input);
var navegador = DOBROWSER();
if(navegador!='explorer'){
var result = btoa(input);

}else{
//b64 for firefox
//btoa("test");
//atob("dGVzdA==");
  var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

	var result = '';
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;

	do {
		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);

		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;

		if (isNaN(chr2)) {
			enc3 = enc4 = 64;
		} else if (isNaN(chr3)) {
			enc4 = 64;
		}

		result += b64chars.charAt(enc1) + b64chars.charAt(enc2) + b64chars.charAt(enc3) + b64chars.charAt(enc4);
	} while (i < input.length);
}//end igualexplorer
	return result;

}
function decode64(input) {
var navegador = DOBROWSER();
if(navegador!='explorer'){
var result = atob(input);

}else{
  var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

	var result = '';
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;

	var input = input.replace(/[^A-Za-z0-9+/=]/g, '');

	do {
		enc1 = b64chars.indexOf(input.charAt(i++));
		enc2 = b64chars.indexOf(input.charAt(i++));
		enc3 = b64chars.indexOf(input.charAt(i++));
		enc4 = b64chars.indexOf(input.charAt(i++));

		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;

		result += String.fromCharCode(chr1);

		if (enc3 != 64)
			result += String.fromCharCode(chr2);

		if (enc4 != 64)
			result += String.fromCharCode(chr3);
	} while (i < input.length);
}// ENd explorer
	return result;
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function cleanFullString(string){
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;

}
function hidediv(divid){
var divid;
	document.getElementById(''+divid+'').style.display='none';

}
function clear_page(){
 document.getElementById('form_area_cont').reset();
 //document.form.reset()
}
//
<!--
var nav4 = window.Event ? true : false;
function accept_chars(evt){
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
return (key == 95 || (key >= 48 && key <= 57) || (key >= 64 && key <= 90)|| (key >= 97 && key <= 121));

}

function _READONLY(VALUES){
var VALUES;
if (VALUES==1){
alert('habilitado');
document.getElementById('form_area_cont').setAttribute('readOnly',false);
}else{
alert('desabilitado');
document.getElementById('form_area_cont').setAttribute('readOnly','readOnly');
}
return true;
}

	function go_page(id){
		window.location = id;
	}

 function stoperror(){
	return true
}
