var Const = {
	toAction:true,
	msgInAction:"Aguarde processo da requisi&ccedil;&atilde;o...<br/><img src='/___his/img/ajax-loader.gif' alt='Carregando'/>",
    title:"<span style='color:#999'>Blog</span><span style='color:#FF6600'>Tv</span>",
    className:"alphacube",
    show:Element.show,
    hide:Element.hide,
    msgBeFilled:"<strong>Voc&ecirc; deve preencher o(s) campo(s):<\/strong><br \/><br \/>"
};
if (typeof(Modal) == 'undefined') var Modal = {};
Modal.alert = function(msg, function_){
    Dialog.alert(msg, 
             {
             width:300,
             title:Const.title,
			 className:Const.className, 
             minWidth:290,
			 maxWidth:450,
			 wiredDrag:true,
			 resizable:true,
			 maxHeight:((document.documentElement.clientHeight)-(document.documentElement.clientHeight*0.25)),
			 hideEffect:Const.hide,
			 showEffect:Const.show,
			 draggable:true, 
             ok:function(){if(typeof function_=='function') function_();return true;}
             });
};
Modal.confirm = function(msg, ok_, cancel_) {
	Dialog.confirm(msg, 
               {
               width:300,
               title:Const.title, 
               className:Const.className,
               minHeight:100,
    		   minWidth:290,
    		   wiredDrag:true,
    		   resizable:true,
    		   maxWidth:500,
    		   hideEffect:Const.hide,
			   showEffect:Const.show,
    		   draggable:true,
               cancel:function(){if(typeof cancel_=='function') cancel_(); return true;},
               ok:function(){if(typeof ok_=='function') ok_(); return true;}
              });
};

Modal.openIFrame = function(_url,w,h,isGetForm,isClosable) {
    if (isGetForm == true)
        _url += '?'+Form.serialize(document.form);
        
    var win = new Window('janela_'+new Date().getTime(),{
        className:Const.className,
        closable:isClosable,
        url:_url,
        title:Const.title,
        width:(w!=0?w:380),
        height:(h!=0?h:200),
        resizable:true,
        wiredDrag:true,
        draggable:true,
    	hideEffect:Const.hide,
		showEffect:Const.show
    });
    win.showCenter();
    win.setDestroyOnClose();
    win.show(true);
}

Modal.serialize = function(form){
	var url = Form.serializeElements(
		form.getInputs('text')
	);
	url += '&' +  Form.serializeElements(
		form.getInputs('hidden')
	);
	url += '&' + Form.serializeElements(
		form.getInputs('radio')
	);
	url += '&' + Form.serializeElements(
		form.getInputs('checkbox')
	);	
	return url;
}