function changeClass(obj, new_class)
{
    obj.className = new_class;
}

function changeBgColor(obj, new_color)
{
	obj.style.backgroundColor=new_color;
}

function changePic(name, pic)
{
	name.src = pic;
}
function removeError(obj){
	obj.className=obj.className.replace(" error", "");
}

function openHide(obj, id){
	class_name = obj.className;
	if(class_name.indexOf(' closed')==-1){
		// close menu
		obj.className += ' closed';
		setCookie("admin_menu_"+id, "closed",8640000);
	}else{
		obj.className=obj.className.replace(/ closed/g, '');
		setCookie("admin_menu_"+id, "opened",8640000);
	}
}
function getCheckedValues(group, hiddenForm)
{
	hiddenForm.value="";
	var x=0;
	for (i = 0; i < group.length; i++)
	{
		if(group[i].checked == true)
		{
			if(x!=0)
			{
				hiddenForm.value+=",";
			}
			hiddenForm.value+=group[i].value;
			x=1;
		}
	}
	
}	

function checkAll(obj,parent_id){
	childs = document.getElementById(parent_id).getElementsByTagName("input");
	for(x=0; x<childs.length; x++){
		if(childs[x].type=="checkbox"){
			if(!childs[x].disabled){
				if(obj.checked)
				childs[x].checked=true;
				else
				childs[x].checked=false;
			}
		}
	
	}
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else 
		countfield.value = "Znakov na voljo: "+ (maxlimit - field.value.length);
}
function decryptEmail(mail){
	
	//var mail = "klemen#ghb#nagode#atz#email#ghb#si";
	var mail_link = mail;
	while(mail_link.indexOf("#ghb#")>0)
	var mail_link = mail_link.replace("#ghb#", ".");
	mail_link = mail_link.replace("#atz#", "@");
	document.location="mailto:"+mail_link;
}
function cryptEmail(mail){
	var mail_link = mail;
	while(mail_link.indexOf(".")>0)
	var mail_link = mail_link.replace(".", "#ghb#");
	mail_link = mail_link.replace("@", "#atz#");
	return mail_link;
}
var xmlhttp
var into_content_id;
function loadXMLDoc(url, target_id){
	loadXMLDoc(url, target_id, false)
}

/* xmlHTTPrequest: update site using AJAX */
//array.concat()
function loadXMLDoc(url, target_id, post_data)
{
document.getElementById("loading").style.display='block';
// code for Mozilla, etc.
target_element = document.getElementById(target_id);

//target_element.innerHTML = "<div class='loading_content' style='height:"+getStyle(target_element, "height")+'></div>';
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.onreadystatechange=function (){
		xmlhttpChange(target_id);
  }
  if(post_data!=''){
  xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  xmlhttp.setRequestHeader("Method", "POST " + url + " HTTP/1.1");

  xmlhttp.send(post_data)
  }else{
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  }
	
  
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=function (){
		xmlhttpChange(target_id);
    }
  if(post_data!=''){
  xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  
  xmlhttp.send(post_data)
  }else{
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  }
    }
  }
}

function xmlhttpChange(target_id)
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
    {
		
		htmlText = xmlhttp.responseText;
		document.getElementById(target_id).innerHTML = htmlText ;
    }
  else
    {
    alert("Problem retrieving XML data, error: " +xmlhttp.status);
	//alert(xmlhttp.responseText);
    }
	
	document.getElementById("loading").style.display='none';
  }
}
function getFieldsValues(form){
	navRoot = form.getElementsByTagName("INPUT");
	navRoot_textArea = form.getElementsByTagName("textarea");
	var getLikePost="";
	var value;
	for (i=0; i<navRoot.length; i++) {
		node = navRoot[i];
		
		/*  we have to replace &  */
		value=node.value.replace(/&/gi, '{[and]}');  //=
		
		
		if(node.getAttribute("type")=="radio" ){
			if(node.checked==true)
				getLikePost+=node.name+"="+value+"&";
				
		}else{

			getLikePost+=node.name+"="+value+"&"
		}
	}
	for (i=0; i<navRoot_textArea.length; i++) {
		node = navRoot_textArea[i];
		getLikePost+=node.name+"="+node.value
	}	
	return getLikePost;
}
function tryRequestPost(action_url, target_id, form){
	values = getFieldsValues(form);
	submited=false;
	loadXMLDoc(action_url, target_id, values);
	return false;
}




function bbCodeTag(tag, button, post_id){
	post = document.getElementById(post_id);
	start = post.selectionStart;
	end = post.selectionEnd;
	if(start!=end && end){
		text = post.value;
		post.value=text.slice(0, start)+"["+tag+"]"+text.slice(start, end)+"[/"+tag+"]"+text.slice(end, text.length);
	}else{
		if(button.value.substring(button.value.length-1, button.value.length )=='*'){
			button.value=button.value.substring(0,button.value.length-1 )
			post.value+='[/'+tag+'] ';
		}else{
			button.value+='*';
			post.value+='['+tag+']';
		}
	}
	post.focus();
}


//Function for adding font color and size tags

function font(bbopen, bbclose, post_id) {
	var post = document.getElementById(post_id);
	start = post.selectionStart;
	end = post.selectionEnd;
	if(start!=end && end){
		text = post.value;
		post.value=text.slice(0, start)+bbopen+text.slice(start, end)+bbclose+text.slice(end, text.length);
	}else{
		post.value += bbopen + bbclose;
		post.focus();
	}
	return;
}
//Function for adding smilies

function smilie (smilie, post_id) {
	var post = document.getElementById(post_id);
	start = post.selectionStart;
	end = post.selectionEnd;
	if(end){
		text = post.value;
		post.value=text.slice(0, start)+smilie+" "+text.slice(end, text.length);
	}else{
        post.value += smilie+" ";
	}
	post.focus();
	return;
}

// Shows the help messages in the helpline window
function helpline(help, helpbox_id) {
        var helpbox = document.getElementById(helpbox_id);
        helpbox.value = help;
}
var isConvertedTable=new Array();
var convertedTable=new Array();
function sortTableBody(table_body_id, th_index, order){
	//if(isSortedTable["table_body_id"]){
	
	//}else
	a = convertTableBodyToArray(table_body_id);
	
	table_body = document.getElementById(table_body_id);
	
	
	var iMin; //Index najmanjšega oziroma največjega uporabnika
	var vMin; // Vrednost najmanjšega uporabnika
	var tmp="";
	for(x=0; x<a.length; x++){
		tmp += '\n'+"________";
		for(y=2; y<a[x].length-1; y++){
			tmp+="//////"+a[x][y];
		}
	}
	//alert(tmp);

	for(i=0; i<a.length; i++) 
	{ 
		iMin=i; 
		vMin=a[i];
		for(j=i+1; j<=a.length-1; j++){ 
			if(order == 'asc'){
				if(a[j][th_index]<vMin[th_index]){
					iMin=j; 
					vMin=a[j]; 
				}
			}else if(order == 'desc'){
				if(a[j][th_index]>vMin[th_index]){
					iMin=j; 
					vMin=a[j]; 
				}
			}else if(order == 'int_asc'){
				if(parseFloat(a[j][th_index])<parseFloat(vMin[th_index])){
					iMin=j; 
					vMin=a[j]; 
				}
			}else if(order == 'int_desc'){
				if(parseFloat(a[j][th_index])>parseFloat(vMin[th_index])){
					iMin=j; 
					vMin=a[j]; 
				}
			}
		} 
		a[iMin]=a[i]; 
		a[i]=vMin; 
	} 
	
	var newBodyHtml = "";
	for(x=0; x<a.length; x++){
		newBodyHtml += "<tr class='mod_"+((x+0)%2)+"'>";
		newBodyHtml +=a[x][0]; 
		
		/*for(y=0; y<a[x].length; y++){
			newBodyHtml += "\t<td>\n";
			newBodyHtml+=a[x][y];
			newBodyHtml += "\t</td>\n";
		}*/
		newBodyHtml += "</tr>";
	}	
	//alert(newBodyHtml);
	tableParentObject = table_body.parentNode.parentNode;
	
	tableInnerHtml = tableParentObject.innerHTML.toString().replace(/<tbody/gi, '´').split('´');	
	tableParentObject.innerHTML = tableInnerHtml[0]+"<tbody id="+table_body_id+">"+newBodyHtml.toString()+"</tbody></table>";


}
function convertTableBodyToArray(table_body_id){
	tableArray=new Array();
	table = document.getElementById(table_body_id);
	navRoot = table.getElementsByTagName("tr");
	
	for(x=0; x<navRoot.length; x++){

		tableArray[x]=new Array(); //tr
		tableArray[x][0]=navRoot[x].innerHTML.replace(/padding-left:/gi, "_invalid:");

		var column = navRoot[x].childNodes;
		var cellIndex=1;		
		for(y=0; y<column.length; y+=1){
			tableArray[x][cellIndex]=column[y].innerHTML.toString().toLowerCase();
			cellIndex++;
		}
		
	}

	return tableArray;
}
function jumpToDate(msgYear, msgMonth, error, url, id){
	var year;
	if(year = prompt(msgYear));
	if(year>1980 && year<2040){
		month = prompt(msgMonth);
		if(month>0 || month<13){
			var fulUrl = url+"&event_date="+year+"-"+month;
			loadXMLDoc(fulUrl, id,'') ;
		}else{
			alert(error);
		}
	}else{
		alert(error);
	}
}



var jsTitle = {
	obj	: null, 
	content: null,
	visible: true,
	objWidth: null, 
	init: function(o){
		obj=o;
		this.start();
		objWidth=getStyle(o, "width");
	},
	start: function(e){
	
		this.hide();
		//obj.innerHTML=Math.random();
		document.onmousemove=this.drag;
	},
	drag: function(e){
		if(visible){
		
			e = jsTitle.fixE(e);
			var y	= e.clientY;
			var x	= e.clientX;
	
			if(x > (2*screen.width/3)){
				x-= objWidth	? parseInt(objWidth) : 60;
			}
			
			xOffset = window.pageXOffset ? window.pageXOffset: parseInt(document.documentElement.scrollLeft);
			yOffset = window.pageYOffset ? window.pageYOffset: parseInt(document.documentElement.scrollTop);
			
			obj.style["left"]=(x+2+xOffset)+"px";
			obj.style["top"]=(y+2+yOffset)+"px"; 
			
		}
	},
	show: function(content, width){
		if(obj){
		visible=true;
		
		obj.innerHTML = content;
		objWidth=getStyle(obj, "width");
		jsTitle.start;
		obj.style["display"]="block";
		//obj.innerHTML=Math.random();
		//fade_in(obj, 100, 0);
		}
	},
	hide: function(){
		if(obj){
		obj.style["display"]="none";
		visible=false;
		}
	},
	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
}
fadeObj=null;
fadeOpacityEnd=null;
fadeOpacity=null;
function fade_in(obj, opacityEnd){
	alert("kk");
	fadeObj=obj
	fadeOpacityEnd=opacityEnd;
	fadeOpacity=0;
	fadeObj.style["opacity"]=0;

	window.setTimeout("opacityIncrease()", 200);

}
function opacityIncrease(){
	if(fadeOpacity<fadeOpacityEnd && fadeOpacity<100){
		fadeObj.style["opacity"]="."+fadeOpacity;
		fadeOpacity+=4;
		
		window.setTimeout("opacityIncrease()", 30);
	}else{
		
	}
}



on_load = new Array()
window.onload = function() {
	
	if (document.all || document.getElementById)
	{
		var mouseObj = document.all ? document.all["mousemove"] : document.getElementById("mousemove");
		jsTitle.init(mouseObj);
	}
	var oP = document.all ? document.all["drager"] : document.getElementById("drager")
	if(oP){
		Drag.init(oP, null, 0, 900, 0, 0);
		oP.onDrag = function(x, y) { resizeMenu(x); }
		oP.onDragEnd = function(x, y) { saveMenuWidth(x); }
	}
	for(x=0; x<on_load.length; x++){
		eval(on_load[x]);
		
	}
	classAllTables();

	
	
}

menuStep = 0;
menuSize = 0;
menuUlObject = 0;
menuObject = 0;

closingStep=0;

function openCloseMenu(obj){
	li = obj.parentNode;
	liNodes = li.childNodes;
	ul = liNodes[1];
	menuUlObject = ul;
	if(ul.style.display=="none"){
		menuChilds = menuObject.childNodes;
		for(x=0; x<menuChilds.length;x++){
			subMenu = menuChilds[x].childNodes;
			if(subMenu.length>1){
				subMenu[1].style.display="none";
			}
		}
		openCloseMenuAnimated(ul.childNodes.length);
		ul.style.overflow="hidden";
	}else{
		//ul.style.display="none";
		closingStep=parseInt(getStyle(ul,"height"));
		openCloseMenuStepClosing();
	}
}

function openCloseMenuStepClosing(){
	if(closingStep>0){
		closingStep-=7;
		if(closingStep<0){
			closingStep=0;
		}
		menuUlObject.style.height=closingStep+"px";

		setTimeout("openCloseMenuStepClosing()", 5);
	}else{
		closingStep=0;
		menuUlObject.style.display="none";
		
	}
}
function openCloseMenuStep(){
	if(menuStep<menuSize+1){
		menuStep++;
		menuUlObject.style.display="block";
		menuUlObject.style.height=menuStep*5+"px";
		menuUlObject.style["opacity"]=Math.round(menuStep/menuSize*10)/10;
		menuUlObject.style["-moz-opacity"]=Math.round(menuStep/menuSize*10)/10;
		setTimeout("openCloseMenuStep()", 5);
	}else{
		menuSize=0;
		menuStep=0;
		menuUlObject.style.display="block";
		
	}
}
function openCloseMenuAnimated(size){
	menuStep = 0;
	menuSize = size*4;
	openCloseMenuStep();
}
function createOpeningMenuItem(obj){	
	if(obj.childNodes.length>1){
		
		liNodes = obj.childNodes;
		for(i=0; i<liNodes.length; i++){
			//alert(liNodes[i].tagName);
			if(liNodes[i].tagName=="UL"){
				if(liNodes[0].className=="active"){
					liNodes[1].style.display="block";
				}else{
					liNodes[i].style.display="none";
				}
			}else if (liNodes[i].tagName=="A"){
				/*liNodes[i].onclick = function(){
					openCloseMenu(this);
					loadXMLDoc(liNodes[i].href+"&_content_only_id="+open_content_id, target_id, post_data)
					return false;
				}*/
			}
		}
		
	}
}
function createOpeningMenu(content_id){
	c = document.getElementById("content_id_"+content_id).childNodes;
	c=c[0].childNodes;
	c=c[2].childNodes;
	c=c[2];
	if(c.childNodes.length<1){
		
		c = document.getElementById("content_id_"+content_id);
		c=c.getElementsByTagName("UL");
		c = c[0];
	}	
	
	menu = c;
	menuObject = menu;
	items = menu.childNodes;

	for(j=0; j<items.length; j++){
		createOpeningMenuItem(items[j]);
	}
}



function resizeMenu(x){
	leftMenu = document.getElementById("left");
	centerContent=document.getElementById("center");
	leftMenu.style["width"]=(x)+"px";
	centerContent.style["margin"]="0 0 0 "+(x)+"px";
}
function saveMenuWidth(x){
	setCookie("admin_menu_x", x, 10000000);

}








/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.		
 **************************************************/
 
 
 
var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},

	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};

var reportBox, iReportCount = 0;


function getStyle(el,styleProp)
{
	var x = el;
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
var autoOpenTab=false;
function createTabs(objId, openTabIndex){
	object=document.getElementById(objId);
	if(object){
		objNodes = object.childNodes;
		tabNamesObj = objNodes[0];
		tabNamesObj.innerHTML='';
		openTabIndex=parseInt(openTabIndex);
		
		if(openTabIndex==-1 && autoOpenTab==true){
			lastTabIndex = getCookie("lastTabIndex");
			openTabIndex=lastTabIndex;
			//alert(lastTabIndex);
		}else if(openTabIndex!=-1){
			//alert(openTabIndex);

			setCookie("lastTabIndex", openTabIndex, 3600000);
		}
		if(openTabIndex==-1)
		openTabIndex=0;
		
		tab = objNodes[1].childNodes;
		
		tabNames = new Array();
		tabIndex=0;
		oneTabOpen=false;
		for(x=0; x<tab.length; x+=1){
			//alert(tab[x].innerHTML);
			temp = tab[x].getElementsByTagName("H3");
			tabNames[tabIndex]=temp[0].innerHTML;
			//alert(temp[0].innerHTML);
			if(tabIndex!=openTabIndex){
				tab[x].style["display"]="none";
				tabNamesObj.innerHTML+="<a href=\"javascript:createTabs('"+objId+"',"+tabIndex+")\"><span class='corner'></span>"+tabNames[tabIndex]+"<\/a> ";
			}else{
				//open tab
				tab[x].style["display"]="block";
				oneTabOpen=true;
				tabNamesObj.innerHTML+="<b><span class='corner'></span>"+tabNames[tabIndex]+"<\/b> ";
			}
			tabIndex++;
		} 
		if(!oneTabOpen){
			tab[0].style["display"]="block";
		}
	}
	//alert("tab_swich");
			
}
function getCookie(name){
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
function setCookie(name, value, expiresSecond){
			var today = new Date();
			var expire = new Date();
			expire.setTime(today.getTime() + expiresSecond);
			document.cookie = name+"="+escape(value)+ ";expires="+expire.toGMTString();
}
var is_preview=false;
function preview(linkObj, text1, text2){
	previewObj = document.getElementById("preview");	
	leftMenu = document.getElementById("left");
	centerContent=document.getElementById("center");
	drager=document.getElementById("drager");
	
	if(!is_preview){
		is_preview=true;
		centerContent.style["display"]="none";
		drager.style["display"]="none";
		leftMenu.style["display"]="none";
		previewObj.style["display"]="block"; 
		bodyObj=document.getElementById("body");
		//height = 
		previewObj.innerHTML = '<iframe id="preview_frame" src ="index.php" width="98%" style="height:430px"> </iframe>';
	}else{
		is_preview=false;
		centerContent.style["display"]="block";
		drager.style["display"]="block";
		leftMenu.style["display"]="block";
		previewObj.style["display"]="none"; 
		previewObj.innerHTML = '';
	
	}
}
function classAllTables(){
	table = document.getElementsByTagName("TABLE");

	for(i=0; i<table.length; i++){
		obj = table[i];

		if(obj.className == "dynamic"){
			classTable(obj);
		}
	}	
}
function classTable(obj){
	
	tr = obj.getElementsByTagName("TR");

	for(x=0; x<tr.length; x+=1){
		td = tr[x].getElementsByTagName("TD");

		for(y=0; y<td.length; y+=1){
			td[y].className = "td_"+y+" td_mod_"+y%2;				
		}
		tr[x].className += " tr_"+x +" tr_mod_"+x%2;
	}
}
