// JavaScript Document

function IsIE()
{
	return navigator.appName.indexOf('Explorer') >= 0;
}


function SetRateFromMousePosition(obj)
{
	if(obj.firstChild == null)return;
//	alert(event.button);
	//if(window.event.button == 1)obj.firstChild.style.width = parseInt(100-100*(obj.clientWidth - window.event.offsetX)/obj.clientWidth) + '%';
}

function SetRateForClick(obj, pos)
{
	if(obj.firstChild == null)return;
	var width = 135;
	//alert('');
	if(IsIE())
	{
//		alert(parseInt(100-100*(obj.clientWidth - window.event.offsetX)/obj.clientWidth) + '%');	
		var percent = parseInt(100-100*(obj.clientWidth - window.event.offsetX)/obj.clientWidth);
		if(percent>=0&&percent<=100)
		{
			obj.firstChild.style.width = percent + '%';
		}
	}
	else
	{
		//pos -= 326;
//		alert(width-pos);
		//alert(pos+'::'+parseInt(100-100*(width - pos)/width+5) + '%');
		par = obj.offsetParent;
	
	offs=obj.offsetLeft;
		
 	while(par!=null)
	 {
	  offs+=par.offsetLeft;
	  par=par.offsetParent;
	 }
	 pos-=offs;

		var percent = parseInt(100-100*(width-pos)/width);
		if(percent>=0&&percent<=100)
		{
			obj.firstChild.nextSibling.style.width = percent + '%';
		}
	}
//	obj.firstChild.style.width = parseInt(100-100*(obj.clientWidth - window.event.offsetX)/obj.clientWidth) + '%';
}

function GetCurrentRate(obj)
{
	return IsIE()?parseInt(obj.firstChild.style.width):parseInt(obj.firstChild.nextSibling.style.width);
}
