function popWindow(url,w,h,scrollbars) 
{
	if(scrollbars) scrollbars = ",scrollbars=yes";
	else scrollbars = "";
	window.open(url, '',  'top=0,left=0,width='+w+',height='+h+scrollbars);
}
function isEmptyStr(strValue) 
{
   strValue = trimAll(strValue);
   if(strValue.length > 0){
     return false;
   }
   return true;
}
function check_all(name)
{
	for (var i = 0; i < document.forms['form'].elements.length; i++)
	{
		var e = document.forms['form'].elements[i];
		if (e.name != name)
		{
			e.checked = eval("document.forms['form']."+name).checked;
		}
	}
}
function trimAll( strValue ) 
{
 var objRegExp = /^(\s*)$/;

    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

var doLoadPage = function (t) {
	$('preloader').style.display = 'none';
	$('page-body').innerHTML = t.responseText;
}
function url(obj)
{
	var strHref = obj.href;
	new Ajax.Request(obj.href, {method: 'get', onSuccess: doLoadPage, parameters: {blank_layout: 1}});
	document.location.href = '#';
	document.location.href = '#'+obj.href.replace(window.location.protocol + "\/\/" + window.location.host,'');
	$('preloader').style.display = 'block';
	$('preloader').style.height = $('page-body').clientHeight+'px';
	return false;
}
function checkUrlAndRedirect()
{
	var url = document.location.href.split("#");
	if(url.length == 2) 
	{
		url = url[1];
		if(url.substr(0,1) == '/') 
		{
			if(Prototype.Browser.IE) document.execCommand('Stop');
			else window.stop();
			document.location.href = url;
		}
	}
}
var last_el = null;
function showEvents(it)
{
	var el = document.getElementsByClassName('onDate');
	var elLink = document.getElementsByClassName('itemlink');
	var itemtd = document.getElementsByClassName('itemtd');
	if(last_el != null) Effect.SlideUp(last_el, {scaleX: true, scaleY: true, duration: 1, afterFinish: function(effect)
																												{
																													var elnk = effect.element.parentNode.getElementsByClassName('itemlink');
																													elnk[0].style.display = 'inline';
																												}
												});
	for(var i=0; i<itemtd.length; i++) el[i].style.width = '';
	Effect.SlideDown('item'+it, {scaleX: true, scaleY: true, duration: 1});
	last_el = 'item'+it;
	$('itemlink'+it).style.display = 'none';
	$('itemtd'+it).style.width = '280px';
}
var doLoadPage = function (t) {
	$('preloader').style.display = 'none';
	$('calendar-container').innerHTML = t.responseText;
}
function getCalendar(href)
{
	last_el = null;
	new Ajax.Request(href, {method: 'get', onSuccess: doLoadPage, parameters: {blank_layout: 1}});
	$('preloader').style.display = 'block';
	$('preloader').style.height = $('calendar-container').clientHeight+'px';
	//$('preloader').style.width = $('calendar-container').clientWidth+'px';
	return false;
}