
	function Selectbox_getIndexByValue(ListboxObj,Value){
		  for (var i=0; i < ListboxObj.options.length; i++) {
		      if (ListboxObj.options[i].value == Value) return i;
		  }
		  return -1;
		}
	
	
	function Selectbox_select(SelectName,Value){
		document.getElementById(SelectName).options[Selectbox_getIndexByValue(document.getElementById(SelectName),Value)].selected=true;
	}

	function changeRequestParam(ParamName,Value){
		var CurrentLocation = location.search.substring(1);
		var pattern = /&ParamName=[a-z]+/
		
		if(CurrentLocation.match(pattern)){
			CurrentLocation = CurrentLocation.replace(pattern,"&"+ParamName+"="+Value);
		}else{
			CurrentLocation = CurrentLocation + "&"+ParamName+"="+Value;
		}
		
		window.location = '?'+CurrentLocation;
	}

	function blurScreen(setActiveMedia){
		var Mask = document.getElementById('FullScrMask');			
			Mask.style.height = document.documentElement.scrollHeight + 'px';
			Mask.style.width = screen.width-22 + 'px';
			Mask.style.bgcolor = '#FFFFFF';
		if(Mask.style.visibility == 'hidden'){
			Mask.style.visibility = 'visible';
			Mask.style.width = '1px';
			if(setActiveMedia)
				chVisibilityByTAGName('SELECT', 'hidden');
		}else {
			Mask.style.visibility = 'hidden';
			Mask.style.width = '1px';
			if(setActiveMedia)
				chVisibilityByTAGName('SELECT', 'visible');
		}
	}
	
	function chVisibilityByTAGName(tag, value, cont){
		if (!cont)
			cont = document;
		var sel = document.getElementsByTagName(tag);
		for (var i = 0; i < sel.length; i++)
			sel[i].style.visibility = value;
	}
	
	function showWidget(divObject,Content,top_y,left_x,setActiveMedia){
		var scrollTOP 	= document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		var scrollLeft 	= document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
		
	    blurScreen(setActiveMedia);
		if(!top_y) 
			var top_y = scrollTOP+270+'px';
		if(!left_x) 
			var left_x = document.body.offsetWidth/3+'px';
	    		
			
		document.getElementById(divObject).style.visibility = 'visible';
		document.getElementById(divObject).style.top = top_y;
		document.getElementById(divObject).style.left = left_x;
		document.getElementById(divObject).innerHTML = Content;	
	}
	
	function hideObject(divObject,makeBlur,setActiveMedia){
		document.getElementById(divObject).style.visibility = 'hidden';
		if(makeBlur)
			blurScreen(setActiveMedia);
	}

	var pixelsLeft = 810;
	var slideInnerBlocksInterval;
	
	function slideInnerOfBlock(Block,Direction){
		clearInterval(slideInnerBlocksInterval);
		pixelsLeft = 810;
		switch(Direction){
			case 'right':
				slideInnerBlocksInterval = setInterval("moveInnerBlockRight('"+Block+"')",20);
			break;
			
			case 'left':
				slideInnerBlocksInterval = setInterval("moveInnerBlockLeft('"+Block+"')",20);
			break;
		}
	}
	
	function moveInnerBlockLeft(BlockId){
		var pixelsStep = Math.round(pixelsLeft/8);
		if(pixelsStep < 1){
			pixelsStep = 1;
		}
		
		document.getElementById(BlockId).scrollLeft+=pixelsStep;
		pixelsLeft -=pixelsStep;
		
		if(pixelsStep <= 1){
			clearInterval(slideInnerBlocksInterval);
			pixelsLeft = 100;
		}
	}
	
	function moveInnerBlockRight(BlockId){
		var pixelsStep = Math.round(pixelsLeft/8);
		if(pixelsStep < 1){
			pixelsStep = 1;
		}
		
		document.getElementById(BlockId).scrollLeft-=pixelsStep;
		pixelsLeft -=pixelsStep;
		
		if(pixelsLeft <= 1){
			clearInterval(slideInnerBlocksInterval);
		}
	}
	
	function scrolltop(val){
		document.documentElement.scrollTop = val;
	}
