/*
=================== CODE MINIMISE =========================

(C) MeloNet Internet Consultancy, 2006-09
http://www.melonet.co.uk
This notice may not be removed from the source code.

=================== CODE MINIMISE =========================
*/
var _objCache = [];
function _Find(id){if(_objCache[id]===undefined || _objCache[id]===null){_objCache[id]=document.getElementById(id);}return _objCache[id];}
function _Uncache(id){_objCache[id]=null;}
function _Value(id){if(document.getElementById(id)!=null){return document.getElementById(id).value;}else{return GetRadio(id);}}
function _Int(id){var v=_Value(id);if(v==''){return 0;}else{return parseInt(v);}}
function _Double(id){return parseFloat(document.getElementById(id).value);}
function _Style(id){return document.getElementById(id).style;}
function _Hide(id){var ux=_Find(id);if(ux){ux.style.display='none';}}
function _Show(id){var ux=_Find(id);if(ux){ux.style.display='block';}}
function _ShowTable(id){document.getElementById(id).style.display='table';}
function _V2Date(id){var ux=_Find(id);if(ux!=null){return DateToEncodeString(ux.value);}}
function _Switch(id){if(_Find(id)!=null && _Style(id).display=='none'){_Show(id);}else{_Hide(id);}}
function _SwitchTblRow(id){if(_Find(id)!=null && _Style(id).display=='none'){_ShowTblRow(id);}else{_HideTblRow(id);}}
function _ShowTblRow(id){document.getElementById(id).style.display='';}
function _HideTblRow(id){document.getElementById(id).style.display='none';}
function _Text(id){return _Find(id).options[_Find(id).selectedIndex].text;}


function urlencode(str){return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');}

function _SetSelected(id,val){
    var ux=_Find(id);
    var len=ux.length;
    for (i=0;i<len;i++){    
        if (val == ux.options(i).text){
            ux.options(i).selected = true;
            return;
        }
    }
}

function ping(){ajax_callback_return_js("handlers/ajax.ping.php","");if(__isLive){setTimeout("ping();",60000);}}setTimeout("ping();",60000);


function _GotoStop(e,url)
{
    _ShowLoad();    
    top.location = _GuRl(url);    
    if(!e){var e = window.event;}
	e.cancelBubble=true;
	if(e.stopPropagation){e.stopPropagation();}
}
function _Goto(url){_ShowLoad();top.location=_GuRl(url);}
function _Loc(url){_ShowLoad();document.location=_GuRl(url);}

function _GuRl(url)
{
	if(url.substr(0,7)=="http://"){return url;}
	
	var b = document.getElementsByTagName('base');
	if (b && b[0] && b[0].href)
	{
		if (b[0].href.substr(b[0].href.length-1) == '/' && url.charAt(0) == '/')
		{
			url=url.substr(1);
		}
	   	url = b[0].href + url;
 	}
 	return url;
}


function _SwitchClass(id)
{
    var obj = _Find("txt"+id);
    if(obj!=null && obj.innerHTML.substring(0,1)=="S"){ 
        /*_Find(id).className=='cbx-unselected'*/
        /*_Find(id).className='cbx-selected';*/
        obj.innerHTML=obj.innerHTML.replace("Show","Hide");
    }
    else
    {
        /*_Find(id).className='cbx-unselected';*/
        obj.innerHTML=obj.innerHTML.replace("Hide","Show");
    }
}



function _ShowLoad()
{
	var container = document.createElement('div');
   	container.setAttribute('id', 'qloader');  
    container.innerHTML="<div><img src='http://esblib.com/skin/1/loading.gif' /></div>";     
    document.body.appendChild(container);
    showMask(5);
}


function _HMS(sec){var h = Math.floor(sec/3600);var m = Math.floor((sec-(h*3600))/60);var s = Math.floor(10*(sec-(m*60)-(h*3600)))/10;if(h>0){return h+"h:"+_NN(m)+"m:"+_NN(s)+"s";}else if(m>0){return m+"m:"+_NN(s)+"s";}else{return s+"s";}}

function _MWD(sec){
var m = Math.floor(sec/2419200);
var w = Math.floor((sec-(m*2419200))/604800);
var d = Math.floor((sec-(w*604800)-(m*2419200))/86400);
var output = "";
if(m>1){output+= m+" Months";}
if(m==1){output+= m+" Month";}
if(m>0 && (w>0 || d>0)) {output+=", ";} 
if(w>1){output+= w+" Weeks";}
if(w==1){output+= w+" Week";}
if(w>0 && d>0) {output+= ", ";}
if(d>1){output+= d+" Days";}
if(d==1){output+= d+" Day";}
return output;
}

function _NN(i) { if(i<10) {return "0"+i;}else {return i;}}

function GetRadio(id){
    for (var i=0; i < document.getElementsByName(id).length; i++){
       if (document.getElementsByName(id)[i].checked){
	    	return document.getElementsByName(id)[i].value;
       }
    }
}

function addEvent(elt,eType,handler,captureMode)
{
	if(document.addEventListener){
		elt.addEventListener(eType,handler,captureMode)
	}
	else{
		elt.attachEvent('on'+eType,handler);
	}
}

function _WindowSize()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return {x:myWidth, y:myHeight};
}

function DateToString(date)
{
    da = new Date(date);
    db = da.toGMTString();
    dc = db.split(" ");
    if(eval(dc[3])<1970){dc[3]=eval(dc[3])+100;}
    return dc[1] + " " + dc[2] + " " + dc[3];
}

function DateToEncodeString(date)
{
    var ml = {"jan":"01","feb":"02","mar":"03","apr":"04","may":"05","jun":"06","jul":"07","aug":"08","sep":"09","oct":"10","nov":"11","dec":"12"}
    //should be dd MMM yyyy
    //          0123456789a
    try
    {
        if(date.length==11)
        {
            return ""+ date.substring(7,11) + ml[date.substring(3,6).toLowerCase()] + date.substring(0,2);
        }
    }
    catch(err){}
    
    //otherwise
    da = new Date(date);
    dout = da.getFullYear();
    mo = da.getMonth()+1;
    if(mo<10) {dout += "0"+mo;}
    else {dout += mo;}
    day = da.getDate();
    if(day<10) {dout += "0"+day;}
    else {dout += day;}  
    return dout;
}

function SCWtoDate(date)
{
    var ml = {"jan":"01","feb":"02","mar":"03","apr":"04","may":"05","jun":"06","jul":"07","aug":"08","sep":"09","oct":"10","nov":"11","dec":"12"}
    //should be dd MMM yyyy
    //          0123456789a
    try
    {
        if(date.length==11)
        {
            return ""+ date.substring(7,11) + "/" + ml[date.substring(3,6).toLowerCase()] + "/" + date.substring(0,2);
        }
    }
    catch(err){}
}


/*
=================== CONTEXTMENU =========================

(C) MeloNet Internet Consultancy, 2006-10

=================== CONTEXTMENU =========================
*/

var _CM = {

    // private attributes
    _menus : new Array,
    _attachedElement : null,
    _menuElement : null,
    _preventDefault : true,
    _preventForms : true,
    _menuWidth : 0,
    _clickId : "",
    _original_bordercolor : new Array,
    _original_color : new Array,
    _original_class : new Array,    
    _propagateCssClass : true,

	//
    // public method. Sets up whole context menu stuff..
    //
	setup : function (conf) 
	{

        if ( document.all && document.getElementById && !window.opera ) 
		{
            _CM.IE = true;
        }

        if ( !document.all && document.getElementById && !window.opera ) 
		{
            _CM.FF = true;
        }

        if ( document.all && document.getElementById && window.opera ) 
		{
            _CM.OP = true;
        }

        if ( _CM.IE || _CM.FF ) 
		{
			//document.addEventListener('contextmenu',_CM._show,false);			
            document.oncontextmenu = _CM._show;
            document.onclick = _CM._hide;
            //document.addEventListener('click',_CM._hide,false);

            if (conf && typeof(conf.preventDefault) != "undefined") {
                _CM._preventDefault = conf.preventDefault;
            }

            if (conf && typeof(conf.preventForms) != "undefined") {
                _CM._preventForms = conf.preventForms;
            }

        }

    },


    // public method. Attaches context menus to specific class names
    attach : function (classNames, menuId, width, propagate)
	{
	    if(propagate!=null) _CM._propagateCssClass = propagate;

		_CM._menuWidth = width;

        if (typeof(classNames) == "string") 
		{
            _CM._menus[classNames] = menuId;
        }

        if (typeof(classNames) == "object") 
		{
            for (x = 0; x < classNames.length; x++) 
			{
                _CM._menus[classNames[x]] = menuId;
            }
        }

    },


    // private method. Get which context menu to show
    _getMenuElementId : function (e) 
	{



        if (_CM.IE) 
		{
            _CM._attachedElement = event.srcElement;
            //_CM._clickId = event.srcElement['id'];

        } 
		else 
		{
            _CM._attachedElement = e.target;
            //_CM._clickId = e.target['id'];
        }


        while(_CM._attachedElement != null) 
		{
            var className = _CM._attachedElement.className;

            _CM._clickId = _CM._attachedElement['id'];

            if (typeof(className) != "undefined") 
			{
                className = className.replace(/^\s+/g, "").replace(/\s+$/g, "")
                var classArray = className.split(/[ ]+/g);

                for (i = 0; i < classArray.length; i++) 
				{
                    if (_CM._menus[classArray[i]]) 
					{
                        return _CM._menus[classArray[i]];
                    }
                }
            }

            if (_CM.IE) 
			{
                _CM._attachedElement = _CM._attachedElement.parentElement;
            } 
			else 
			{
                _CM._attachedElement = _CM._attachedElement.parentNode;
            }
        }

        return null;

    },


    // private method. Shows context menu
    _getReturnValue : function (e) 
	{

        var returnValue = true;
        var evt = _CM.IE ? window.event : e;

        if (evt.button != 1) 
		{
            if (evt.target) 
			{
                var el = evt.target;
            } 
			else if (evt.srcElement) 
			{
                var el = evt.srcElement;
            }

            var tname = el.tagName.toLowerCase();

            if ((tname == "input" || tname == "textarea")) 
			{
                if (!_CM._preventForms) 
				{
                    returnValue = true;
                } 
				else 
				{
                    returnValue = false;
                }
            } 
			else 
			{
                if (!_CM._preventDefault) 
				{
                    returnValue = true;
                } 
				else 
				{
                    returnValue = false;
                }
            }
        }

        return returnValue;

    },


	//
	// Stops context menu crossing edge of page
	//
	_checkWidth : function (position) 
	{
        var size = _WindowSize();
        
	    end = (position.x+_CM._menuWidth+16);
	      
	    if( end > size.x ) 
		{
		 	position.x = position.x-_CM._menuWidth+16 ;
		}
	
	    return position;
     },


    _highlight : function () 
	{

            if( _CM._clickId )
            {
	            temp = _Find(_CM._clickId);
	
				_CM._original_class[0] = temp.className;
	
	            temp.className += 'hover';
	
    
                if(_CM._propagateCssClass)
                {
    				tr = temp.firstChild;
    				cnt = 1;
    				while(tr)
    				{
    				
    					if ( tr['style'] != undefined )
    					{
    						_CM._original_class[cnt] = tr.className;
    						
    						if(tr.className!="")
    						{
    							tr.className += 'highlight';
    						}
    					}
    					tr = tr.nextSibling;
    					cnt++;
    				}
                }
            }
    },

    _unhighlight : function () 
	{

            if( _CM._clickId )
            {
	            temp = _Find(_CM._clickId);
				temp.className = _CM._original_class[0];
	
                if(_CM._propagateCssClass)
                {
    	            tr = temp.firstChild;
    				cnt = 1;
    				while(tr)
    				{
    	
    					if ( tr['style'] != undefined )
    					{
    					   tr.className = _CM._original_class[cnt];
    					}
    				   	tr = tr.nextSibling;
    					cnt++;
    	   			}
                }
            }
    },


	//
    // private method. Shows context menu
    //
    _show : function (e) 
	{

        _CM._hide();
        var menuElementId = _CM._getMenuElementId(e);

        if (menuElementId && _CM._clickId) 
		{
			
            var position = _CM._getMousePosition(e);

            position = _CM._checkWidth(position);

            _CM._menuElement = _Find(menuElementId);
            _CM._highlight();
            if(_CM._menuElement!=null)
            {
                _CM._menuElement.style.left = position.x + 'px';
                _CM._menuElement.style.top = position.y + 'px';
                _CM._menuElement.style.display = 'block';
            }
            return false;
        }

        return _CM._getReturnValue(e);

    },


	//
    // private method. Hides context menu
    //
    _hide : function () 
	{

		_CM._unhighlight();

        if (_CM._menuElement) 
		{
            _CM._menuElement.style.display = 'none';
        }

    },

	//
    // private method. Returns mouse position
    //
    _getMousePosition : function (e) 
	{   e = e || window.event;
	    var cursor = {x:0, y:0};
	    if (e.pageX || e.pageY) 
		{
	        mX = e.pageX;
	        mY = e.pageY;
	    }
	    else 
		{
	        var de = document.documentElement;
	        var b = document.body;
	        mX = e.clientX +(de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
	        mY = e.clientY +(de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	    }
	
	    return { 'x' : mX, 'y' : mY };
    }

}
_CM.setup({'preventDefault':false, 'preventForms':false});


/*
=================== SCROLLHELPER =========================

(C) MeloNet Internet Consultancy, 2006-11

=================== SCROLLHELPER =========================
*/
function GetScroll()
{
    var y=document.body.scrollTop;
 
    if (y==0)
    {
        if (window.pageYOffset){return  window.pageYOffset;}
        else{return (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;}
    }
    return y;
}
function SetScroll(y)
{
    window.scrollTo(0,y);
}



/*
=================== CONTROLGROUPS =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== CONTROLGROUPS =========================
*/

function groupRepShow(sMenu,groupName,total,inc)
{
	selectMenu = _Find(sMenu);
	tot = parseInt(selectMenu.value)+inc;
	for(i=1;i<=tot;i++){_Show(groupName+i);}
	j=1+tot;
	for(i=j;i<=total;i++){_Hide(groupName+i);}
}

/*
=================== CONFIRM =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== CONFIRM =========================
*/

function confirm_op($page,$type)
{
	if(confirm("Are you sure you wish to "+$type+"?")){_Loc($page);}
}

function confirm_link($type)
{
	if(confirm("Are you sure you wish to "+$type+"?")){return true;}
	return false;
}

/*
=================== AJAX =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== AJAX =========================
*/
var req = create_http_request();
function ajax_callback(target,xml)
{
    try
    {     
        req.open("POST", target,true);
        req.send(xml);
    }catch(e){return;}
}
function create_http_request()
{
    try
    {
        if (window.XMLHttpRequest){return new XMLHttpRequest();}
        else if (window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}
    }catch(e){return;}
}

var ajax_inProgress = false;
var ajax_queue = new Array;
function ajax_next_inqueue()
{
    if(ajax_queue.length>0)
    {
        var tmp = ajax_queue.pop();
        ajax_callback_return_js(tmp[0],tmp[1]);
    }
}

function ajax_callback_return_js(target,xml)
{
    if(ajax_inProgress)
    {
        /* Try again later*/
        //setTimeout("ajax_callback_return_js('"+target+"','"+xml+"');",100);
        ajax_queue.push([target,xml]);
        return;
    }
    
    try
    {     
        req.open("POST", target, true);
        req.onreadystatechange = callbackFunction;
        req.send(xml);
        ajax_inProgress = true;
    }catch(e){return;}
}
function callbackFunction()
{
  if (req.readyState != 4) {return;}
  ajax_inProgress = false;  
  try
  {
    if(req.responseText!="") {eval(req.responseText);}
  }
  catch(e)
  {
    //alert(req.responseText);
  }
  ajax_next_inqueue();
}

/*
=================== AD CLICK =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== AD CLICK =========================
*/

function ajax_ad_click(id){ajax_callback("handlers/ajax.adclick.php",id);}


/*
=================== HIERACHICAL GRID =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== HIERACHICAL GRID =========================
*/
function sSubGrid(name)
{

    var row = _Find(name);
    if(row.className=="sport")
    {   
        row.className = "sportzoom";
        _Find("im_"+name).src='ims/dropdownbw_wide.png';
        
        var charttr = _Find("charttr_"+name);
        if(charttr)
        {
            charttr.style.display='table-row'; 
        }
    }
    else
    {
        row.className = "sport";
        _Find("im_"+name).src='ims/dropdownbw_wideright.png';
        
        var charttr = _Find("charttr_"+name);
        if(charttr)
        {
            charttr.style.display='none'; 
        }        
    }
    
	for(i=1;i<100;i++)
	{
		if(_Find(name+i)!=null)
		{
			if(_Style(name+i).display=='none'){
			 _Style(name+i).display='table-row';             
             }
			else{
			 _Hide(name+i);             
            }
		}else return;
	}
}

/*
=================== QUICK LOAD FORMS =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== QUICK LOAD FORMS =========================
*/
function showMask(alpha)
{
    if(typeof alpha=="undefined") alpha = 8;
    
    var mask = document.createElement('div');
	mask.setAttribute('id', 'qblur');
	//alpha = 8;
	mask.style.opacity = alpha/10;
	mask.style.filter = 'alpha(opacity=' + alpha*10 + ')';
	mask.style.display = 'block'; 
    
    var wny = GetDocHeight();
    
    mask.style.height = wny+"px";    
    
    document.body.appendChild(mask);
    
}
function GetDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

var $$window_iframe_name = "qiframe";
function createForm(url,title,top,width,height)
{
	//scroll(0);
	
	var container = document.createElement('div');
   	container.setAttribute('id', 'qlaunch');
    
    if(typeof top!="undefined" && top!=null) {container.style.top = top;}

	var win = document.createElement('div');
	win.setAttribute('id', 'qwin');
    win.className = "fwin";
    
    /*width:600px;height:380px;*/
    if(typeof width!="undefined" && width!=null) {win.style.width = width+"px";}
    if(typeof height!="undefined" && height!=null) {win.style.height = height+"px";}
    
	var header = document.createElement('div');

	//alert('4');
	header.setAttribute('id', 'qheader');
	header.innerHTML = "<img src='http://esblib.com/i/16/cross.png' onclick='closeForm();' /><span>"+title+"</span>";
   	
   	var iframe = document.createElement('iframe');
    $$window_iframe_name = "qiframe"+new Date().getTime();
  	iframe.id=$$window_iframe_name;
    iframe.name=$$window_iframe_name;
   	iframe.setAttribute('id', $$window_iframe_name);
   	iframe.src = url;
    //document.getElementById('qiframe').contentWindow.location.reload(true);
   	iframe.frameBorder = 0;
    
    if(typeof width!="undefined" && width!=null) {iframe.style.width = (width-4)+"px";}
    if(typeof height!="undefined" && height!=null) {iframe.style.height = (height-26)+"px";}

	//alert('6');
   	
   	win.appendChild(header);
   	win.appendChild(iframe);
    
    showMask(6); 
	   	
	container.appendChild(win);
   	document.body.appendChild(container);
   	//document.documentElement.style.overflow = "hidden";
	//alert('10');   	
}

function submittedForm()
{
    /*obj = document.getElementById("qiframe");
    document.getElementById("qwin").removeChild(obj);//'
    
	obj = document.getElementById("qlaunch");
  	document.body.removeChild(obj);*/    
}

function closeAndCreateForm(url,title,top,width,height)
{

    closeForm();
    createForm(url,title,top,width,height);
    
}

function closeForm()
{
    obj = document.getElementById($$window_iframe_name);
    document.getElementById("qwin").removeChild(obj);//'
    
	obj = document.getElementById("qlaunch");
  	document.body.removeChild(obj);
  	obj = document.getElementById("qblur");
  	document.body.removeChild(obj);
    
    //alert(document.documentElement.style.overflow);
    //document.body.style.overflow = "auto";
	//document.body.style.overflow = "";
	//document.documentElement.style.overflow = "auto";
    
    
	//scroll(2);
}

function scroll(i)
{
      if ( document.documentElement && document.documentElement.scrollTop )
      {
            document.documentElement.scrollTop = i;
      }
      else if ( document.body )
      {
            document.body.scrollTop = i;
      }
}


/*
=================== COUNTDOWN =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== COUNTDOWN =========================
*/


var currentRace = new Number(0);
var clockcntr = new Number(0);
var races_ls = new Array();
var races_dt = new Array();


function tickClock()
{
	var dt = races_dt[currentRace];
	
	if(dt!=null)
	{
		var now = new Date();
		var diff = (dt.getTime()-now.getTime())/1000;
	
		var weeks = Math.floor(  diff/(60*60*24*7)  );
		var week_s = weeks*60*60*24*7;
		_Find("vweek").innerHTML = _NN(weeks);
	
		var days = Math.floor(  (diff-week_s)/(60*60*24)  );
		var day_s = days*60*60*24;
		_Find("vday").innerHTML = _NN(days);
	
		var hours = Math.floor(  (diff-week_s-day_s)/(60*60)  );
		var hour_s = hours*60*60;
		_Find("vhour").innerHTML = _NN(hours);
	
		var mins = Math.floor(  (diff-week_s-day_s-hour_s)/(60)  );
		var min_s = mins*60;
		_Find("vmin").innerHTML = _NN(mins);
	
		var secs = Math.floor(  (diff-week_s-day_s-hour_s-min_s)  );
		var sec_s = secs;
		_Find("vsec").innerHTML = _NN(secs);
	
		var ms = Math.floor((diff-week_s-day_s-hour_s-min_s-sec_s)*1000);
	
	
		clockcntr++;
		if(clockcntr>25)
		{
			clockcntr = 0;	
			nextClock();
		}
		setTimeout("tickClock();",ms);
	}
	else setTimeout("tickClock();",600);
}

var letter = 0;
function writeClockTitle()
{
	var title = races_ls[currentRace];
	
	if(title!=null)
	{
		_Find("vtitle").innerHTML += title.charAt(letter);
		letter++;
		if(letter<title.length)
		{
			setTimeout("writeClockTitle();",70);	
		}
	}
	else setTimeout("writeClockTitle();",600);
}

function nextClock()
{
	currentRace++;
	if(currentRace>=races_ls.length) {currentRace = 0;}	
	
	_Find("vweek").innerHTML = "00";
	_Find("vday").innerHTML = "00";
	_Find("vhour").innerHTML = "00";
	_Find("vmin").innerHTML = "00";
	_Find("vsec").innerHTML = "00";
	_Find("vtitle").innerHTML = "&nbsp;";
	letter = 0;
	writeClockTitle();
}

/*
=================== STAR =========================

(C) MeloNet Internet Consultancy, 2006-09

=================== STAR =========================
*/

function starReg(id)
{
    val = _Find(id).value;
    
    s="l";
    for(i=5;i<=50;i+=5)
    {
        if(i==5) j = "05";
        else j = i;
        
        if((i/10)<=val) {_Find('star'+j+id).className = s+'star_sel';}
        else {_Find('star'+j+id).className = s+'star';}
        
        if(s=="l") {s="r";}
        else {s="l";}
    }
}

function starShow(id,val)
{
    val=val/10;
    s="l";
    for(i=5;i<=50;i+=5)
    {
        if(i==5) j = "05";
        else j = i;
        
        if((i/10)<=val) {_Find('star'+j+id).className = s+'star_sel';}
        else {_Find('star'+j+id).className = s+'star';}
        
        if(s=="l") {s="r";}
        else {s="l";}
    }
    
}

function starClick(id,val)
{
    val=val/10;
    s="l";
    for(i=5;i<=50;i+=5)
    {
        if(i==5) {j = "05";}
        else {j = i;}
        
        if((i/10)<=val) {_Find('star'+j+id).className = s+'star_sel';}
        else {_Find('star'+j+id).className = s+'star';}
        
        _Find('star'+j+id).onmouseover = function (){};
        _Find('star'+j+id).onmouseout = function (){};
        _Find('star'+j+id).onclick = function (){};
        
        if(s=="l") {s="r";}
        else {s="l";}
    }
    
    _Find(id).value = val;
    _Find(id).onchange();
}







/*
=================== MESSAGE BAR =========================

(C) MeloNet Internet Consultancy, 2006-10

=================== MESSAGE BAR =========================
*/

var $$mb_message;
var $$mb_type;
var $$mb_cheight;
var $$mb_scrollmode;
var $$mb_wn_maw = null;
var $$mb_wn_ms = null;
var $$mb_wn_mci = null;

function $$mb_draw()
{
    var ani = document.createElement("div");
    ani.id = "MessageAnimationWindow";
    ani.className = "MessageAnimationWindow";
    _Find("esBody").appendChild(ani);   
    $$mb_wn_maw = ani;
    
    var sh = document.createElement("div");
    sh.id = "MessageShadow";
    sh.className = "MessageShadow";
    ani.appendChild(sh);    
    $$mb_wn_ms = sh;
       
    var c = document.createElement("div");
    c.id = "MessageContainer";
    c.className = "BottomMessage";
    if($$mb_type=='m'){c.className += " MessageContainer";} 
    else if($$mb_type=='e'){c.className += " ErrorContainer";} 
    
    if($$mb_type=='m'){icon = "information.png";} 
    else if($$mb_type=='e'){icon = "error.png";}     
        
    var ic = document.createElement("div");
    ic.id = "MessageContainerInner";
    ic.className = "CenteredSection MessageInner";
    ic.innerHTML = "<img src=\"ims/"+icon+"\" /><br/>"+$$mb_message;
    c.appendChild(ic);
    $$mb_wn_mci = ic;
    
    var fc = ic.firstChild;
    var cl = document.createElement("div");
    cl.id = "MessageClose";
    cl.className = "MessageClose";
    cl.onclick = $$mb_close;
    if($$mb_type=='m'){cl.innerHTML = "<div>close <img src=\"ims/close_bl.png\" /></div>";} 
    else if($$mb_type=='e'){cl.innerHTML = "<div>close <img src=\"ims/close_wh.png\" /></div>";}         
    ic.insertBefore(cl,fc);      
    
    ani.appendChild(c);   
    
    $$mb_cheight = 0;
    $$mb_scrollmode = 4;
    $$mb_scroll();
    setTimeout("$$mb_close()",5000);
}

function $$mb_close()
{
    if($$mb_wn_maw==null) {return;}
    
    close = _Find("MessageClose");
    if(close)
    {
        $$mb_wn_mci.removeChild( close );
    }
    
    $$mb_scrollmode = -3;
    $$mb_scroll();
}

function $$mb_scroll()
{
    if($$mb_wn_maw==null) {return;}
    
    $$mb_cheight+=$$mb_scrollmode;
    if($$mb_cheight>95) {$$mb_cheight = 95;}
    if($$mb_cheight<0) {$$mb_cheight = 0;}
    
    $$mb_wn_maw.style.height = $$mb_cheight+"px";
    
    if($$mb_cheight==95){return;}
    if($$mb_cheight==0){return $$mb_end();}
    
    setTimeout("$$mb_scroll();",16);
}

function $$mb_end()
{
    if($$mb_wn_maw==null) {return;}
    
    $$mb_wn_ms = null;
    $$mb_wn_maw = null;
    $$mb_wn_mci = null;
    
    _Find("esBody").removeChild( _Find("MessageAnimationWindow") );
}

