/*
 *产品迁移助手JS
 */
var laststate;
var laststate2;
var overimg=function(){
	laststate=document.getElementById('arrowimg').src;
	document.getElementById('arrowimg').src='images/transferdarkblue.png';
}
var leaveimg=function(){
	laststate2=document.getElementById('arrowimg').src;
	document.getElementById('arrowimg').src=laststate;
}
var downimg=function(){
	laststate2=document.getElementById('arrowimg').src;
	document.getElementById('arrowimg').src='images/transferpurple.png';
}
var upimg=function(){
	document.getElementById('arrowimg').src=laststate2;
	jsign=laststate.indexOf('transfergreen');
	if(jsign>-1)
	{
		document.getElementById('transform').submit();
	}
}
var originchange=function(){
	if(document.getElementById('destcate').selectedIndex==-1)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
	}else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].getAttribute('exclusion')==document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].value)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
		document.getElementById('news').innerHTML="不需要移动";
	}
	else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].value==document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].value)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
		
		document.getElementById('news').innerHTML="源类和目标类相同";
	}
	else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].getAttribute('needlevel')>document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].getAttribute('providelevel'))
	{
		document.getElementById('arrowimg').src='images/transferred.png';
		if(document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].getAttribute('needlevel2')==1){
				document.getElementById('news').innerHTML="不可以移动到三级类下";
			}else if(document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].getAttribute('providelevel')==0){
				document.getElementById('news').innerHTML="目标类下有产品";
			}else{
				document.getElementById('news').innerHTML="超过了三级类";

				}
	}
	else
	{
		document.getElementById('arrowimg').src='images/transfergreen.png';
		document.getElementById('news').innerHTML="";
	}
}
var destchange=function(){
	if(document.getElementById('origincate').selectedIndex==-1)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
	}
	else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].getAttribute('needlevel')>document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].getAttribute('providelevel'))
	{
		document.getElementById('arrowimg').src='images/transferred.png';
	}
	else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].getAttribute('exclusion')==document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].value)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
	}
	else if(document.getElementById('origincate').options[document.getElementById('origincate').selectedIndex].value==document.getElementById('destcate').options[document.getElementById('destcate').selectedIndex].value)
	{
		document.getElementById('arrowimg').src='images/transferred.png';
	}
	else
	{
		document.getElementById('arrowimg').src='images/transfergreen.png';
		document.getElementById('news').innerHTML="";
	}
}