var confirmMsg  = 'This operation have not rollback, ';
function confirmarLink(theLink, theconfirmMsg,row_id)
{
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return false;
	    }
    var is_confirmed = confirm(confirmMsg + '\n' + theconfirmMsg);
    if (is_confirmed) {
		get('ak_row'+row_id).style.display='none';
		goAJAX('',str_replace('ak_m=B','ak_m=BS',theLink.href), '','','','0','0')
	    }
return false;
}
function akiInitJs(){
	if ($('jsInit')){
		eval($('jsInit').innerHTML);
		}
	}
function akiSysAjax(a,b){
	var x = a.search('ak_m');
	if((1<a.search('ak_m=E'))||(1<a.search('ak_m=N'))){
		goAJAX(b,a+'&ajax=yeah','','akiInitJs();');
		}else{
			goAJAX(b,a+'&ajax=yeah','');
			}
	return false;
	}
function akiSysAjaxPost(a,b,c){
	goAJAX(b,a,c+'&ajax=yeah');
	return false;
	}
function akiSysAjaxPostSimpleValidation(a,b,c){
	 var msg=validateAllFields('frmABMN');
	 if(msg!=''){
		 	alert(msg);
		 	}else{
				goAJAX(b,a,c+'&ajax=yeah');
				}
	
	return false;
	}
function akiSysAjaxG(a,b){
	GetId('sSecName').innerHTML=b;
	goAJAX('sMain',a+'&ajax=yeah','');
	return false;
	}

function validateAllFields(frm){
	o = document.forms[frm].elements[0];
	var xP='';//o.name+'='+escape(o.value);	
	var t='';
	var msg='';
	for (i=0; i<document.forms[frm].elements.length; i++) {
		ob = document.forms[frm].elements[i];
		if (ob.type == 'radio'){
			}else if(ob.type == 'checkbox'){
			if (ob.checked){
				}else{
				if (ob.value==''){
					t=ob.name;
					t=str_replace('_id','',t);
					t=str_replace('_',' ',t);
					msg+='- '+ t + "\n";
					}
				}
		} else {
				if (ob.value==''){
					t=ob.name;
					t=str_replace('_id','',t);
					t=str_replace('_',' ',t);
					msg+='- '+ t + "\n";
					}
		}
	}
	if (msg!=''){
			msg="Please complete the following fields: \n"+msg;
			}
return msg;
}
function sShowCalendar(sInputField,sButton){
							Zapatec.Calendar.setup({
							firstDay          : 1,
							 weekNumbers       : false,
							showOthers        : false,
							showsTime         : false,
							timeFormat        : "24",
							step              : 2,
							range             : [1900.01, 2999.12],
							electric          : false,
							singleClick       : true,
							inputField        : sInputField,
							button            : sButton,
							ifFormat          : "%Y-%m-%d",
							daFormat          : "%Y-%m-%d",
							align             : "Br"
						});
}
function mOvr(src,clrIn) {//on mouse in
	src.style.cursor = 'hand';
	src.bgColor = clrIn;	
	}
function mOut(src,clrIn) {// on mouse out
	src.style.cursor = 'default';
	src.bgColor = clrIn;
	}
function mClk(src) {//on click
	//src.bgColor = "#ffcc99";
	}






function xinit_editor(content){
	
		toggleEditor(content);
	}
var activeEditors = new Array()

function activateEditor(id, c) {
    activeEditors[activeEditors.length] = id;
    tinyMCE.settings=tinyMCE.configs[c];
    toggleEditor(id);
}

function deactivateEditors() {
    for(x=0;x<activeEditors.length;x++) {
        toggleEditor(activeEditors[x])
    }
    activeEditors.length = 0
}

// functions
function toggleEditor(id) {
    var elm = document.getElementById(id);

    if ((tinyMCE.getInstanceById(id) == null)){
		tinyMCE.execCommand('mceAddControl', false, id);
		}else{
        tinyMCE.execCommand('mceRemoveControl', false, id);
		//$(id+'_container').remove(element);
		if ($(id+'_container')) Element.remove(id+'_container'); 
		//var x = new Element.remove( id+'_container' );
		//$('frmB').remove(id+'_container');
		
		}
}

function trySaveBlog(a,b){
	if ((strlen(get('title').value)>8)&&(strlen(get('tags').value)>8)&&(strlen(get('content').value)>40)){
		tinyMCE.triggerSave();
		return akiSysAjaxPost(a,b,akiSfrm('frmABME'));
		}else{
			alert("Your Content is to short or you need \n to fill out the Title or the Tags fields.");
			return false;
			}
	}