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.*
mousex = 0;
mousey = 0;
top_ch = -10;

check_script = '/wp-content/plugins/exchangers-monitor/check.php';

if(isNetscape4) document.captureEvents(Event.MOUSEMOVE)

if(isMSIE ){
  document.onmousemove=function(){
    mousex=event.clientX+document.body.scrollLeft;
    mousey=event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
    top_=document.documentElement.scrollTop-top_ch;

    return true;
  }
}
else if(isOpera7)
{
    document.onmousemove=function(){
	mousex=event.clientX+document.body.scrollLeft;
	mousey=event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
	top_=0-top_ch;

	return true;
    }
}
else if(isOpera)
{
  document.onmousemove=function(){
    mousex=event.clientX;
    mousey=event.clientY;

    top_=0-top_ch;

    return true;
  }
}
else if(isNetscape4 || isMozilla)
{
  document.onmousemove=function(e){
    mousex = e.pageX;
    mousey = e.pageY;
    
    top_=document.body.scrollTop-top_ch;

    return true;
  }  
}

function showInfo(id)
{
	var el = document.getElementById(id);
	var info = document.getElementById('xobmen_info');
	info.innerHTML = el.innerHTML;
	info.style.display = 'block';	
	info.style.left=(mousex+15)+"px";
	info.style.top=(mousey-top_ch)+"px";
}
function hideInfo()
{
	var info = document.getElementById('xobmen_info');
	info.style.display = 'none';
}





function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

$(function(){
	$('#mx_form_first_ul li:not([class=group])').css('color', '#ccc');
	$('#mx_form_change_ul li:not([class=group])').css('color', '#ccc');
		if($('#welc').val() == undefined && $('#calcform_first').val() != undefined){		
		$.post(check_script,'id_f='+$('#calcform_first').val(),function(data){
			for(var i=0;i<data.length;i++) {
				$('#mx_form_change_ul li[rel='+data[i]+']').css('color', ''); 
			}
		},'json');
				$.post(check_script,'id_c='+$('#calcform_change').val(),function(data){
			for(var i=0;i<data.length;i++) {
				$('#mx_form_first_ul li[rel='+data[i]+']').css('color', '');  
			}
			$('#mx_form_first_ul').removeAttr('disabled');
		},'json');
		} else{
		
		$.post(check_script,'check=1',function(data){
			for(var i=0;i<data.length;i++) {
				$('#mx_form_first_ul li[rel='+data[i]+']').css('color', '');  
				$('#mx_form_change_ul li[rel='+data[i]+']').css('color', '');  
			}
		},'json');
		}
});
function first(){
		$('#mx_form_change_ul').attr('disabled','disabled');
		$('#mx_form_first').css('color','');
		$('#mx_form_change_ul li').css('color', '#ccc');
		$.post(check_script,'id_f='+$('#mx_form_first').val(),function(data){
			for(var i=0;i<data.length;i++) {
				$('#mx_form_change_ul li[rel='+data[i]+']').css('color', ''); 
			}
			$('.group').css('color','');
			$('#mx_form_change_ul').removeAttr('disabled');
		},'json');
		mchange();
	};
function second(){
		$('#mx_form_first_ul').attr('disabled','disabled');
		$('#mx_form_change').css('color','');
		$('#mx_form_first_ul li').css('color', '#ccc');
		$.post(check_script,'id_c='+$('#mx_form_change').val(),function(data){
			for(var i=0;i<data.length;i++) {
				$('#mx_form_first_ul li[rel='+data[i]+']').css('color', '');  
			}
			$('.group').css('color','');
			$('#mx_form_first_ul').removeAttr('disabled');
		},'json');
		mchange();
	};

