function resizeWindow()
{
	var mainWidth = document.getElementById('mainArea');
	var merka = document.getElementById('merka'); 
	var topLine = document.getElementById('topLine');
	var topLine2 = document.getElementById('topLine2');
	var contentArea = document.getElementById('contentArea');
	var footerArea = document.getElementById('footerArea');
	//var welcomeTxtIns = document.getElementById('welcomeTxtIns');
	//var welcomeNews = document.getElementById('welcomeNews');
	
	if (mainWidth)
	{
		//alert(merka.clientWidth);
		//alert(mainWidth.clientWidth);
		var aWidth = "";
		var cWidth = 0;
		//if (isCatalog)
		//{
			cWidth = 1320;
			aWidth = "1320px";
		//}
		//else
		//{
			//cWidth = 1250;
			//aWidth = "1250px";
		//}

		if (mainWidth.clientWidth > cWidth && merka.clientWidth > cWidth)
		{
			//mainWidth.style.width = aWidth;
			if (topLine)
				topLine.style.width = "1320px";	

			if (topLine2)
				topLine2.style.width = "1320px";
									
			if (contentArea)
				contentArea.style.width = "1320px";	
							
			if (footerArea)
				footerArea.style.width = "1320px";				
		}
		else
		{
			if (topLine)
				topLine.style.width = "100%";	
				
			if (topLine2)
				topLine2.style.width = "100%";
											
			if (contentArea)
				contentArea.style.width = "98%";
					
			if (footerArea)
				footerArea.style.width = "100%";											
		}
	} 	
}

function RolloverImgs(imgObg,img) 
{ 
	//var imgObg = document.getElementById(imgObg);
	if (imgObg && img)
	{
		imgObg.src = img;
		//alert(img);
		//imgObg.className = ''; 
		//imgObg.style.background = "url('"+img+"')"; 
		//imgObg.runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + imgObg.style.backgroundImage.substr( 4, imgObg.style.backgroundImage.length - 5 ) + '", sizingMethod="crop")';
		//imgObg.style.background = "#000000"; 
	}
}

//var prevBG = new Array;
var MenuSH = new Array;
var lastId = "";
var alwaysOpen = 0;

function OverOutTD(idTd, type)
{
	var tdObj = document.getElementById(idTd);
	var widthTd = tdObj.offsetWidth;
	//var addWidthTd = (tdObj.offsetWidth*30)/100;
	//var widthSub = widthTd + addWidthTd;
	var widthSub = widthTd-10;
	//widthSub = (widthSub<180)?180:widthSub;
	
	if (tdObj)
	{
		//hideAll(idTd);
		
		var subObj = document.getElementById('sub_'+idTd);
		var aObj = document.getElementById('a_'+idTd);
		
		switch (type)
		{
			case "over":
				MenuSH[idTd]=1;	
				//if (prevBG[idTd]=="" || !prevBG[idTd])
					//prevBG[idTd] = tdObj.style.background;
				
				//if (subObj)	
					//tdObj.style.background = "url('img/bg/menu_over2.gif') no-repeat center top";
				//else
					tdObj.style.background = "#191811";
					
				if (aObj)
				{
					aObj.className = "overMade";
				}				
				if (subObj)
				{
					subObj.style.width = widthSub + "px";
					//if (lastId == idTd)
						//subObj.style.marginLeft = "-"+(addWidthTd+7)+ "px";
					//var lineObj = document.getElementById("line_"+idTd);
					//if (!lineObj)
					//{
						//addLine = "<div id=\"line_"+idTd+"\" style=\"background:#ffffff;height:4px;margin-bottom:14px;margin-left:"+(widthTd-7)+"px;\"></div>";
						//subObj.innerHTML = addLine + subObj.innerHTML;
					//} 					
					subObj.style.display = "block";
				}
				break;
				
			case "out":
				MenuSH[idTd]=0;
				setTimeout('outTD("'+idTd+'")',0);				
				break;
		}		
	}
}

function outTD(idTd)
{
	if (MenuSH[idTd]==0)
	{
		var tdObj = document.getElementById(idTd);
		//if (prevBG[idTd] && prevBG[idTd]!="")
		//{
			tdObj.style.background = "none";
			//prevBG[idTd] = "none";	
		//}

		var subObj = document.getElementById('sub_'+idTd);
		if (subObj)
		{
			subObj.style.display = "none";
		}
				
		var aObj = document.getElementById('a_'+idTd);
		if (aObj)
		{
			aObj.className = "outMade";
		}		
	}
}

function hideAll(currentTd)
{
	for (i=0; i < MainDivs.length; i++) 
	{	
		if (MainDivs[i])
		{
			if (MainDivs[i]!=currentTd && MainDivs[i]!=alwaysOpen) 
			{
				var obj = document.getElementById(MainDivs[i]);
				if (obj)
				{
					//if (prevBG[MainDivs[i]] && prevBG[MainDivs[i]]!="")
					//{
						obj.style.background = "none";
						//prevBG[MainDivs[i]] = "none";
					//}
				}
				
				var subObj = document.getElementById('sub_'+MainDivs[i]);
				if (subObj)
				{
					subObj.style.display = "none";
				}
				
				var aObj = document.getElementById('a_'+MainDivs[i]);
				if (aObj)
				{
					aObj.className = "outMade";
				}					
			}
			
			lastId = MainDivs[i];				
		}
	}	
} 

function clearValue(obj,toPwd)
{
	if (obj)
	{
		obj.value = "";
		if (toPwd)
		{
			var parent = obj.parentNode;
			var objId = obj.id;
			
			if (parent != null)
			{
				var oldInput = parent.innerHTML;
				
				oldInput = oldInput.replace('type="text"','');
				oldInput = oldInput.replace('onfocus=clearValue(this,1);','onfocus=clearValue(this,0);');
				oldInput = oldInput.replace('onclick=clearValue(this,1);','onclick=clearValue(this,0);');
				oldInput = oldInput.replace('onfocus="clearValue(this,1);"','onfocus="clearValue(this,0);"');
				oldInput = oldInput.replace('onclick="clearValue(this,1);"','onclick="clearValue(this,0);"');

				oldInput = oldInput.replace('>',' type="password">');
				
				if (oldInput.search(/type=password/i) == -1)
				{
					parent.removeChild(obj);
					parent.innerHTML = oldInput;
				
					var newObj = document.getElementById(objId)
					if (newObj)
					{
						newObj.focus();
						newObj.focus();
					}
				}
			}
		}
	}
} 

function checkKey(e,withCtrl,keys,urls)
{
	var code;
	if (!e) var e = window.event;
	
	if (withCtrl == 1)
	{
		if (e.keyCode && e.ctrlKey) code = e.keyCode;
		else if (e.which && e.ctrlKey) code = e.which;	
	}
	else
	{
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;			
	}

	//alert(code);
	if (keys.length>0)
	{
		for (i=0; i < keys.length; i++)
		{
			if (code == keys[i])
			{
				if (urls[i])
				{
					//alert(urls[i]);
					window.location = urls[i];
				}
			}
		}
	}	
}

function checkKey2(e,id)
{
	var code;
	
	if (!e) var e = window.event;
	
	var keyPressObj = (e.srcElement)?e.srcElement:null;
	keyPressObj = (e.target)?e.target:keyPressObj;
	
	if (e.keyCode)
	{
		code = e.keyCode;
	}
	else if (e.which) 
	{
		code = e.which;	
	}
	
	var dontSubmit = 0;
	if (keyPressObj)
		if (keyPressObj.type == "textarea" || keyPressObj.type == "button")
			dontSubmit = 1;
	
	if (code == 13 && !dontSubmit)
	{
		var submitForm = document.getElementById(id);
		if (submitForm)
		{
			submitForm.submit();
		}
	}
	
} 

function setBg(thisObj,color)
{
	thisObj.style.backgroundColor = color;
}

function add_click (url,target) {
	if (url) {
	//alert("Debug:"+url);
	//alert("Debug:"+target);
	if (target=="_parent") {
	parent.location.href=url;
	}
	if (target=="_blank") {
	window.open(url);
	}
	if (target=="_self") {
	location.href=url;
	}
	if (target=="_top") {
	top.location.href=url;
	}
	}//end if !url
}

function applyFiltr(formId,selectId)
{
	var formObj = document.getElementById(formId);
	var selectObj = document.getElementById(selectId);
	if (formObj == null || selectObj == null)
		return;

	index = selectObj.selectedIndex 
	if (selectObj[index] == 0)
		return;
		
	formObj.submit();
}

function replaceContent(id,url)
{	
	//ShowMessage();
	HTML_AJAX.replace(id,url);
}

function getCalendar(id,p,url)
{
	var SendURL = "ajax.php?p="+p+"&"+url;
	//alert(SendURL);
	//window.scrollTo(0,0); 
	StatusMessage();
	
	var loadingM = document.getElementById('loadingSI');
	if (loadingM)
		loadingM.style.display = "block"; 
			
	replaceContent(id,SendURL);
}  

function setupMessage()
{
	var loading = document.getElementById('HTML_AJAX_LOADING');
	if (!loading) 
	{
		loading = document.createElement('div');
		loading.id = 'HTML_AJAX_LOADING';
		loading.innerHTML = '';		
		loading.className = 'HTML_AJAX_Loading';
		loading.count = 0;	

		document.body.insertBefore(loading,document.body.firstChild);
	} 
	
	loading.style.display = "none";
}

function StatusMessage()
{
	setupMessage();
	return;
	
	//var stMessage = document.getElementById('HTML_AJAX_LOADING');
	//if (stMessage == null)
	//{
		//return;
	//}
		
	//var newPlace = document.getElementById(idContent);	
		
	//if (newPlace != null)
	//{
		//var insertInParent = (newPlace.parentNode)?newPlace.parentNode:newPlace.parent;			
		//insertInParent.appendChild(stMessage);		
	//}
	
	//var parentWidth = insertInParent.offsetWidth;
	
	//stMessage.style.left = "auto";
	//stMessage.style.right = 40 +  "px";
	//stMessage.style.width = 100 +  "px";
	//stMessage.style.height = 20 +  "px";
	//stMessage.style.top = "149px";
	//stMessage.style.display = "block";
}