var ajaxRetObj;
function doAjax(url, params, onSuccess, onError) {
    $.ajax({
        type: "POST",
        dataType: "text",
        url: ((RootAddress) ? RootAddress : "")+url,
        data: params,
        success: onSuccess,
        error: onError,
        scriptCharset: "UTF-8"
    });
}

$().ajaxStart(function() {
	if(ajaxRetObj) {
		r = absolutePosition(ajaxRetObj);
		$("#ajax-ind").css("left",r.x+"px").css("top",r.y+22+"px");
		$("#ajax-ind").show();
	}
});
$().ajaxStop(function() { ajaxRetObj=null; $("#ajax-ind").hide(); });

$(document).ready(function() {
	if (navigator.appVersion.match(/MSIE [0-7]\./)) $('*').each(function () {
		  if (this.currentStyle.backgroundImage != 'none') {
			src = this.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
		    if (src) {
		        src = src[1]; 
			    $(this).css({'backgroundImage': 'none', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='" + src + "')"});
			 }
		  }
	});

	$('HR').attr("color","#4f4f4f");
	$('#mainMenu A')
		.css( {backgroundPosition: "0px 25px"} )
		.mouseover(function(){ $(this).stop().animate({backgroundPosition:"(0px 50px)"}, {duration:300}) })
		.mouseout (function(){ $(this).stop().animate({backgroundPosition:"(0px 25px)"}, {duration:200, complete:function(){ $(this).css({backgroundPosition: "0px 25px"}) }}) });
	$('#catalogMenu TH')
		.css( {backgroundPosition: "0px 25px"} )
		.mouseover(function() {
			$(this).stop().animate({backgroundPosition:"(0px 50px)"}, {duration:300});
			if(drop = $(this).children("#dropMenu")) if(drop.length>0) {
				r = absolutePosition(this);
				drop.css("left",r.x+248+"px");
				drop.css("top", r.y-46+"px");
				drop.css("display","");
			}
		})
		.mouseout (function() {
			$(this).stop().animate({backgroundPosition:"(0px 25px)"}, {duration:200, complete:function(){ $(this).css({backgroundPosition: "0px 25px"}) }})
			if(drop = $(this).children("#dropMenu")) if(drop.length>0) drop.css("display","none");
		});
	
	var objInput = $('INPUT');
	for(i=0; i<objInput.length; i++) if(objInput[i].alt!="") $(objInput[i]).blur(function(){ changeText(this,this.alt,0) }).focus(function(){ changeText(this,this.alt,1) });
	
	var objInput = $('.bigheader');
	for(i=0; i<objInput.length; i++) {
		text = objInput[i].innerHTML;
		objInput[i].innerHTML = '<span><img src="'+RootAddress+'images/header_b.gif" align="absmiddle"> ' + text + '</span><img src="'+RootAddress+'images/header_m.png" align="absmiddle">';
	}
	
	var objInput = $('.info');
	for(i=0; i<objInput.length; i++) {
		text = objInput[i].innerHTML;
		objInput[i].innerHTML = '<table border="0" cellspacing="0" cellpadding="0" width="100%" id="Info"><tr><td width="27" height="23"><img src="'+RootAddress+'images/info.jpg" width="23" height="21"></td><td style="background:url('+RootAddress+'images/grey.gif) repeat-x center" align="right"><img src="'+RootAddress+'images/spacer.gif" style="background-color:#eeeeee" width="5" height="1"><img src="'+RootAddress+'images/spacer.gif" style="background-color:#5c010f" width="21" height="1"></td></tr><tr><td style="background:url('+RootAddress+'images/grey.gif) repeat-y center" valign="bottom" align="center"><img src="'+RootAddress+'images/spacer.gif" style="background-color:#eeeeee" width="1" height="5"><br><img src="'+RootAddress+'images/spacer.gif" style="background-color:#5c010f" width="1" height="21"></td><td>' + text + '</td></tr></table>';
	}
	
	var objInput = $('.workitem');
	for(i=0; i<objInput.length; i++) {
		hObj = $("H2", objInput[i]);
		caption = hObj[0].innerHTML;
		hObj.remove();
		text = objInput[i].innerHTML;
		objInput[i].innerHTML = '<table border="0" cellspacing="0" cellpadding="0" id="workitem" align=center><tr><td valign="top"><img src="'+RootAddress+'images/w_lt.gif" height="10" width="8"></td><td rowspan="2" style="padding-bottom:5px"><h2><img src="'+RootAddress+'images/header_b.gif" align="absmiddle"> '+caption+'</h2>' + text + '</td><td valign="top"><img src="'+RootAddress+'images/w_rt.gif" height="10" width="8"></td></tr><tr><td valign="bottom"><img src="'+RootAddress+'images/w_lb.gif" height="10" width="8"></td><td valign="bottom"><img src="'+RootAddress+'images/w_rb.gif" height="10" width="8"></td></tr></table>';
	}
});