// determine browser
isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=window.opera && isDOM //Opera 5+
isOpera6=isOpera && window.print //Opera 6+
isOpera7=isOpera && document.readyState //Opera 7+
isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
isMSIE5=isDOM && isMSIE //MSIE 5+
isNetscape4=document.layers //Netscape 4.*
isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*

// define X and Y position determinition
if (isNetscape4 || isMozilla)
{
	mousex = 0;
	mousey = 0;

	if (isNetscape4) document.captureEvents(Event.MOUSEMOVE);

	if (isMSIE || isOpera7) {
	  document.onmousemove=function() {
	    mousex=event.clientX+document.body.scrollLeft;
	    mousey=event.clientY+document.body.scrollTop;
	    return true;
	  }
	}
	else if (isOpera) {
	  document.onmousemove=function() {
	    mousex=event.clientX;
	    mousey=event.clientY;
	    return true;
	  }
	}
	else if (isNetscape4 || isMozilla)   {
	  document.onmousemove=function(e) {
	    mousex = e.pageX;
	    mousey = e.pageY;
	    return true;
	  }  
	}
}

function getElementPosition(elem)
{
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return {"left":l, "top":t, "width": w, "height":h};
}


function populate_bottom()
{
	cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
	var top_search_categories_head = document.getElementById("top_search_categories_head");
	if ( top_search_categories_head ) var top_search_categories_head_width = top_search_categories_head.offsetWidth;
	
	if (cross_marquee) {
		cross_marquee.style.left= theShift + "px"
		actualwidth=document.all ? temp.offsetWidth : document.getElementById("temp").offsetWidth
				
		if ( top_search_categories_head_width )
		if ( actualwidth < top_search_categories_head_width ) {
			copyspeed = 0;
			cross_marquee.style.left= '0px';
		}
		
		cross_marquee.style.visibility = 'visible';
		lefttime=setInterval("scrollmarquee()",25)
	}

	
	cross_marquee_topads=document.getElementById? document.getElementById("iemarquee_topads") : document.all.iemarquee_topads
	var top_search_categories_head_topads = document.getElementById("top_search_categories_head_topads");
	if ( top_search_categories_head_topads ) var top_search_categories_head_width_topads = top_search_categories_head_topads.offsetWidth;
	
	if (cross_marquee_topads) {
		cross_marquee_topads.style.left= theShift_topads + "px"
		actualwidth_topads=document.all ? temp_topads.offsetWidth : document.getElementById("temp_topads").offsetWidth
		cross_marquee_topads.style.visibility = 'visible';
		lefttime_topads=setInterval("scrollmarquee_topads()",15)
	}
	
	
	cross_marquee_bottom=document.getElementById? document.getElementById("iemarquee_bottom") : document.all.iemarquee_bottom
	ticker_main_bottom=document.getElementById? document.getElementById("ticker_main") : document.all.ticker_main
	
	if ( cross_marquee_bottom && ticker_main_bottom )
	{
		cross_marquee_bottom.style.left = ticker_main_bottom.offsetWidth - theShift_bottom + "px"
		actualwidth_bottom=document.all ? temp_bottom.offsetWidth : document.getElementById("temp_bottom").offsetWidth
		cross_marquee_bottom.style.visibility = 'visible';
		lefttime_bottom=setInterval("scrollmarquee_bottom()",10)
	}
}

function scrollmarquee_bottom()
{
	if (parseInt(cross_marquee_bottom.style.left)>(actualwidth_bottom*(-1)+8+200))
		cross_marquee_bottom.style.left=parseInt(cross_marquee_bottom.style.left)-copyspeed_bottom+"px"
	else
		cross_marquee_bottom.style.left=parseInt( ticker_main_bottom.offsetWidth ) +8+"px"
}

function sa(s){alert(s)}

// hide error messages
function hide_error_message(theElement)
{
	var oDiv = document.getElementById("message_error");
	
	if (oDiv)
	oDiv.className = 'wmsmh';
}

function fetch_object(idname) {
	if (document.getElementById)	return document.getElementById(idname);
	else if (document.all)			return document.all[idname];
	else if (document.layers)		return document.layers[idname];
	else							return null;
}