function rollOver(obj) {
        obj.style.backgroundColor = '#ffffff';
}
function rollOut(obj) {
        obj.style.backgroundColor = '#F9F9F9';
}

function popupWindow(url) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=352,height=260,screenX=150,screenY=150,top=5,left=5')
}			

function objectt(nr, act) {

  if(act!='') current = (act == 1) ? 'block' : 'none';

  if (document.layers) {

		if(act=='') {
			if(document.layers[nr].display == 'block') document.layers[nr].display = 'none';
			else document.layers[nr].display = 'block';
		} else document.layers[nr].display = current;

	} else if (document.all) {

		if(act=='') {
			if(document.all[nr].style.display == 'block') document.all[nr].style.display = 'none';
			else document.all[nr].style.display = 'block';;
		} else document.all[nr].style.display = current;

	}	else if (document.getElementById)	{

		if(act=='') {
			if(document.getElementById(nr).style.display == 'block') document.getElementById(nr).style.display = 'none';
			else document.getElementById(nr).style.display = 'block';;
		} else document.getElementById(nr).style.display = current;		
		
	}
}

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);
};


function submitForm(fname, errclass, resid){
	str = $("#"+fname).serializeArray();
	url = $("#"+fname).attr("action");
        $("."+errclass).html('');
        
	$.post(url, str,
            function(data) {
                //alert(data);
                
                if(data.result == 'notok') {
                    $.each(data.errors, function(i, item){
                        $('#f'+i+' .err').html(item);

                    });
                } else {
                    $("#"+resid).html('<div id="ok">'+data.msg+'</div>');
                }
                
            },
            'json'
        );
}

function toggleStatus(checkid, inpid) {
    if ($('#'+checkid).is(':checked')) {
        $('#'+inpid).removeAttr('disabled');
    } else {
        $('#'+inpid).attr('disabled', true);
    }
}