/*  JavaScript Document  */

/*
 ====  MaiMaiJ.com JavaScriptSheet  ======================================================
 Javascript Name : default.js
         Version : 1.0 
          Author : XiaoWen
         Explain : 将default.html的JS集中在此文档
  	  Last Update: 2008-03-14 14:16
		../
*/
function setDivContent(){
	new Element.show('downLoading');
	new Element.hide('Left_Content');
	new Ajax.Request('../obj/help/AjaxHelpShow.asp',{
			method:'get',
			parameters:{url_Id:'content_li',lang:'cn'},
			onSuccess:function(response){eval(response.responseText);}
		}
		
	);
	new Element.show('Left_Content');
	new Element.hide('downLoading');
}



/*
 * setDivContentDemo 初始化帮助左册内容
 * 
*/
function setDivContentDemo(itemPara){
//	setScriptLeftTag(itemPara)
	
	new Element.show('downLoading');
	new Element.hide('Left_Content');
	
	var str = 'http://dataport.maimaij.com/obj/help/AjaxHelpShow_CH1.asp?lang=cn';
	if(itemPara != ''){
		str = 'http://dataport.maimaij.com/obj/help/AjaxHelpShow_CH1.asp?lang=cn&typeId='+itemPara;
	}
	var head = document.getElementsByTagName('head')[0];
	if($('leftNoteData')) head.removeChild($('leftNoteData'));
	var node = document.createElement('script');
		node.src = str;
		node.type= 'text/javascript';
		node.id = 'leftNoteData';
	head.appendChild(node);
		
	new Element.show('Left_Content');
	new Element.hide('downLoading');
}

/*
 * showContentText 更新帮助左册条目样式以及调用获得右册内容
 * 
*/
var lastDivId = '';
function showContentText(typeId,typeTitle){
	
	document.getElementById("content_li_interior"+typeId).className = "YellowList";
	if(lastDivId == ''){
		lastDivId = typeId;
	}else{
		if(typeId != lastDivId){
			document.getElementById("content_li_interior"+lastDivId).className = "List";
			lastDivId = typeId;
		}
	}
	Element.update('Topleft',typeTitle);
	setScriptTag(typeId);
	
}

/*
 * setScriptTag 根据ID获得右册帮助内容
 * 
*/
function setScriptTag(typeId){

	var head = document.getElementsByTagName('head')[0];
	if($('NoteData')) head.removeChild($('NoteData'));
	var node = document.createElement('script');
		node.src = 'http://dataport.maimaij.com/obj/help/AjaxHelpRightContent_CH.asp?id='+RndNum()+'&typeId='+typeId;
		node.type= 'text/javascript';
		node.id = 'NoteData';
	head.appendChild(node);
	showContent_Submit();
	new Element.show('content_Submit_header');
	new Element.show('content_Submit_Div');
	new Element.hide('OCR6_header');
}

/**
*	函数： updateLiColor()
*	目的： 修改点中的li的颜色（点中的颜色改变，其余的不变）
*	接收： ul_Id ul的ID号
*		  li_Id li的ID号
*	返回： 无
*/
	var newId,oldId;
function updateLiColor(ul_Id,li_Id){
	if(newId != ""){
		oldId = newId;
	}
	newId = li_Id;
	$('content_li_interior'+newId).style.color = '#6E6B64';
	$('content_li_interior'+newId).style.backgroundColor = '#FCDA7B';
	if(oldId != "" &&  newId != oldId && newId != "" && oldId != null){
		$('content_li_interior'+oldId).style.color = '#666666';
		$('content_li_interior'+oldId).style.backgroundColor = '#FCF8D5';
	}
}
/*
*	函数：showContent_Submit
*	作用：显示用户提交意见填写单元
*/
function showContent_Submit(){
	$('userAdvice').value = '';
	new Element.show('content_Submit');
}
/*
*	函数：submit_AdviceContent
*	作用：提交用户意见内容
*	返回：提交过程处理完毕给用户一个提示
*/
var checkId = '1';
function submit_AdviceContent(){
	if(checkId == '1'){
		var checkBoxValueS = "";
		var checkBoxIdS = $('submit_Select_Div').getElementsByTagName('input');
		$A(checkBoxIdS).each(function(s){
			if(s.checked){
				checkBoxValueS = checkBoxValueS + s.value;
			}
		});
		if(checkBoxValueS == ""){
			$('OCR6_header').innerHTML = 'Please choose scores.!';
			document.getElementById("OCR6_header").className = "WarningMsg";
			new Element.show('OCR6_header');
		}else{
			document.getElementById("OCR6_header").className = "OCR6_header1";
			new Element.show('OCR6_header');
			checkId = '0';
			new Ajax.Request('../obj/help/HelpInsertAdvice.asp',{
				method:'get',
				parameters:{helpC_Id:$F('helpC_Id'),userMark:checkBoxValueS,userAdvice:$F('userAdvice')},
					onSuccess:function (response){eval(response.responseText);}
				}
			);
			Element.update('OCR6_header','Thank you for submitting proposal! Our services will be better and better!');
			new Effect.Pulsate('OCR6_header',{afterFinish:function(){}});
		}
	}else{
		$('OCR6_header').innerHTML = '数据正在提交，请稍后填写！';
		new Effect.Pulsate('OCR6_header',{afterFinish:function(){}});			
	}
}
function RndNum(){
	var rnd="";
	for(var i=0;i<6;i++)
	rnd+=Math.floor(Math.random()*10);
	return rnd;
}
