/* IE6 flicker fix
-------------------------------------------------- */
try { document.execCommand("BackgroundImageCache", false, true); } catch(err){}

/* Togglers */

function toggleId(id) {
    $(id).style.display = ($(id).style.display == "none") ? "" : "none";
}

function toggleItems() {
	$A(toggleItems.arguments).each(function(id){
	    toggleId(id);
	});
}

function HasClassName(objElement, strClass){
	if ( objElement.className ){
		var arrList = objElement.className.split(' ');
		var strClassUpper = strClass.toUpperCase();
		for ( var i = 0; i < arrList.length; i++ ){
			if ( arrList[i].toUpperCase() == strClassUpper ){
				return true;
			}
		}
	}
   return false;
}

/* Class manipulation */

function AddClassName(objElement, strClass, blnMayAlreadyExist){
	if ( objElement.className ){
		var arrList = objElement.className.split(' ');
		if ( blnMayAlreadyExist ){
			var strClassUpper = strClass.toUpperCase();
			for ( var i = 0; i < arrList.length; i++ ){
				if ( arrList[i].toUpperCase() == strClassUpper ){
					arrList.splice(i, 1);
					i--;
				}
			}
		}
		arrList[arrList.length] = strClass;
		objElement.className = arrList.join(' ');
	} else {
		objElement.className = strClass;
	}
}

function RemoveClassName(objElement, strClass){
	if ( objElement.className ){
		var arrList = objElement.className.split(' ');
		var strClassUpper = strClass.toUpperCase();
		for ( var i = 0; i < arrList.length; i++ ){
			if ( arrList[i].toUpperCase() == strClassUpper ){
				arrList.splice(i, 1);
				i--;
			}
		}
		objElement.className = arrList.join(' ');
	}
}

function showVideo(domain, size_x, size_y){
	domain = (domain == null ? 'viru' : domain);
	size_x = (size_x == null ? '500' : size_x);
	size_y = (size_y == null ? '415' : size_y);
	openCenteredWindow(js_site_url + "video/index_" + domain + ".html", size_y, size_x, "videowindow","location=0,directories=0,menubar=0,resizable=0,width=" + size_x + ",height=" + size_y + "");
}



function openCenteredWindow(url, height, width, name, parms) {
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}