﻿jQuery(document).ready(function(){
	jQuery(".secondLineBg").add(".diversityShowBg").add(".aboutShowBg").add(".rYellowBg").add(".rBackBg").add(".culturalCon_bg").animate({opacity:0.9},0); 
	line_IMG();
	showAbout();
	showRecruitment();
	showCultural();
	showSmallImg();
	showNews();
	showContactus();
})

function line_IMG(){//菜单
	jQuery(".botton").mouseover(function(){
		jQuery(this).attr("src",jQuery(this).attr("src").replace("_1","_2"));
		var secondLineLeft=0;
		var lineHtml="";
		for(var i=0;i<jQuery(".botton").length;i++){
			if(jQuery(".botton")[i]==this){
				secondLineLeft=i*120;
				switch(i){
					case 1:
					lineHtml="<a href='about.aspx' target='main'>集团简介</a><div>&nbsp;</div><a href='president_message.aspx' target='main'>总裁致词</a><div>&nbsp;</div><a href='history.aspx' target='main'>发展历程</a><div>&nbsp;</div><a href='structure.aspx' target='main'>集团架构</a><div>&nbsp;</div><a href='honor.aspx' target='main'>益丞荣誉</a><div>&nbsp;</div>"
					break
					case 3:
					lineHtml="<a href='cultural.aspx' target='main'>企业文化</a><div>&nbsp;</div><a href='operate.aspx' target='main'>经营理念</a><div>&nbsp;</div>";
					break
					case 4:
					lineHtml="<a href='trade.aspx' target='main'>贸易物流</a><div>&nbsp;</div><a href='manufacturing.aspx' target='main'>工业制造</a><div>&nbsp;</div><a href='commercial.aspx' target='main'>商业服务</a><div>&nbsp;</div><a href='realEstate.aspx' target='main'>房地产业</a><div>&nbsp;</div><a href='investment.aspx' target='main'>投资发展</a><div>&nbsp;</div>";
					break
					case 6:
					lineHtml="视频广告<div>&nbsp;</div>平面广告<div>&nbsp;</div>";
					break
					}
				}			
			}
		if(lineHtml==""){
			jQuery(".secondLine").hide();
			}else{
		jQuery(".secondLineText").html(lineHtml).find("a").click(function(){
			setOtherPage(jQuery(this).attr("url"));
			jQuery(".secondLine").hide();
		});
		jQuery(".secondLine").css("margin-left",secondLineLeft).show();		
		
		}
	}).mouseout(function(){
		jQuery(this).attr("src",jQuery(this).attr("src").replace("_2","_1"));		
		}).click(function(){
			setOtherPage(jQuery(this).attr("url"));
			
			})
	
	jQuery("body").mouseover(function(){
		jQuery(".footBg").mouseover(function(){return false})
		jQuery(".secondLine").hide();
		})
}

function setIframeHegith(){//iframe高度	
	jQuery("#otherPage").height(jQuery("#otherPage").contents().find("body").height());
	}

function setOtherPage(url){//iframe跳页
	jQuery("#otherPage").attr("src",url);
	}
	
function showAbout(){//集团概况动画
	jQuery(".aboutBg").fadeIn("slow");
	jQuery(".aboutHead").animate({width:"100%"},1000).fadeIn("slow",function(){
		jQuery("#E_Text").fadeIn("slow",function(){
			jQuery("#aboutZT").show().animate({marginLeft:"10px"},100,function(){
				jQuery("#aboutGF").css("margin-left","10px").fadeIn("slow");
			});
		});
		jQuery(".showAboutBg").animate({opacity:0.9,width:"100%"},1000).add(".PMphoto").fadeIn("slow",function(){jQuery("img").fadeIn("slow")});
	});
		
	}

function aSIurl(id,url,width,height){
	var wid=470;
	var hei=440;
	if(width)wid=width;
	if(height)hei=height;
	if(width || height)jQuery(".aboutShowBg").css("padding","10px");
	if(jQuery("#"+id).css("display")=="none"){
	jQuery("#"+id).show().add(".aboutShowBg").animate({width:wid,height:hei},500,function(){jQuery(".aboutIframe").fadeIn("slow")});
	jQuery("#checkClose").click(function(){jQuery(".aboutIframe").fadeOut("slow",function(){jQuery("#"+id).animate({width:"0px",height:"0px"},500,function(){jQuery(this).hide();});});})
	}
	jQuery(".aboutIframe").attr("src",url);
	}

function showRecruitment(){
	jQuery(".recuitmentBg").fadeIn("slow");
	jQuery(".recuitmentList").animate({right:"0px"},1000,function(){
			jQuery(".search").add(".rYellowBg div").add(".rBackBg div").fadeIn("slow");
		});
	}
function showRecruitmentTable(){
	jQuery(".search").hide();
	jQuery("#recruitmentShowTable").show();
	}
function showRecruitmentTable2(){
	parent.jQuery(".search").hide();	
	parent.jQuery("#recruitmentShowTable").show().find(".aboutTable").attr("src","recruitment_table.aspx?id="+request("id"));
	}
function closeRecruitmentTable(){
	jQuery("#recruitmentShowTable").hide();
	jQuery(".search").show();
	}
function showCultural(){
	jQuery(".culturalBg").fadeIn("slow");
	jQuery(".culturalLine_bg").animate({opacity:0.6},0);
	jQuery(".culturalCon").animate({top:0},500);
	}
function showSmallImg(){
	jQuery(".lineImg img").add(".diversityShowBody").hover(function(){
		clearTimeout(ASI);	
	},function(){
		ASI=setTimeout("autoShowImg('right')",5000);
		})
	jQuery(".diversityBg").fadeIn("slow");
	jQuery(".smallImg").css("margin-left",(jQuery("body").width()-900)/2).animate({bottom:0});	
	
	var tableWidth=jQuery(".lineImg table").width()-900;
	var ImgWidth=172;
	var tableML=0;
	
	jQuery(".diverstyLR").eq(0).click(function(){
			tableML=parseInt(jQuery(".lineImg table").css("margin-left"));
			if(tableML>-ImgWidth){
				jQuery(".lineImg table").animate({marginLeft:tableML});
				}else{
					jQuery(".lineImg table").animate({marginLeft:tableML+ImgWidth});
				}					
		});
	
	jQuery(".diverstyLR").eq(1).click(function(){
			tableML=parseInt(jQuery(".lineImg table").css("margin-left"));
			if(tableML<=-tableWidth){
				jQuery(".lineImg table").animate({marginLeft:tableML});
				}else{
					jQuery(".lineImg table").animate({marginLeft:tableML-ImgWidth});
				}			
		});
		
	jQuery(".lineImg img").hover(function(){		
		jQuery(this).animate({width:"170px",marginLeft: "0px",marginRight:"0px"},500).next().fadeIn("slow");
	},function(){
		jQuery(this).animate({width:"142px",marginLeft: "14px",marginRight:"14px"},500).next().fadeOut("slow");
		}).click(function(){
			diversityHtml(jQuery(this));
			var diversityBg=jQuery(this).attr("src").replace("upfileS","upfileB");
			var smallName=jQuery(this).attr("name");
			jQuery(".diversityBg").fadeOut("slow",function(){jQuery(this).attr("name",smallName).css({"background-image":"url("+diversityBg+")"}).fadeIn("slow")});
			})
	
	jQuery(".ocSmallImg").toggle(function(){
			jQuery(this).find("img").attr("src","images/up.gif");
			jQuery(".smallImg").animate({bottom:-130});
		},function(){
			jQuery(this).find("img").attr("src","images/down.gif");
			jQuery(".smallImg").animate({bottom:0});
			})
	
	jQuery(".closeRight img").toggle(function(){
			jQuery("#diversityShow").animate({right:"-450px"});
			jQuery(this).attr("src","images/left.gif");
		},function(){
			jQuery("#diversityShow").animate({right:"20px"});
			jQuery(this).attr("src","images/right.gif");
			});
		
	}

function showNews(){
	jQuery(".newsBg").fadeIn("slow");
	}
	
function showContactus(){
	jQuery(".contactusBg").fadeIn("slow");
	}
	
function diversityHtml(obj){
			jQuery(".diversityShowBody b").html(obj.attr("title"));
			jQuery(".diversityShowBody div").html(obj.attr("conttext"));
	}
	
var ASI;
	
function autoShowImg(Direction){	
	var bigName=jQuery(".diversityBg").attr("name");
	var smallName;
	if(Direction=="right"){
		smallName=parseInt(bigName)+1;
		if(jQuery("img[name="+smallName+"]").length>0){			
			var diversityBg=jQuery("img[name="+smallName+"]").attr("src").replace("upfileS","upfileB");			
			jQuery(".diversityBg").fadeOut("slow",function(){jQuery(this).attr("name",smallName).css({"background-image":"url("+diversityBg+")"}).fadeIn("slow")});
			ASI=setTimeout(function(){autoShowImg("right")},5000);
			diversityHtml(jQuery("img[name="+smallName+"]"));
		}else{
			smallName=parseInt(bigName)-1;
			var diversityBg=jQuery("img[name="+smallName+"]").attr("src").replace("upfileS","upfileB");
			jQuery(".diversityBg").fadeOut("slow",function(){jQuery(this).attr("name",smallName).css({"background-image":"url("+diversityBg+")"}).fadeIn("slow")});
			ASI=setTimeout(function(){autoShowImg("left")},5000);
			diversityHtml(jQuery("img[name="+smallName+"]"));
			}
	}else if(Direction=="left"){
		smallName=parseInt(bigName)-1;
		if(jQuery("img[name="+smallName+"]").length>0){
			var diversityBg=jQuery("img[name="+smallName+"]").attr("src").replace("upfileS","upfileB");
			jQuery(".diversityBg").fadeOut("slow",function(){jQuery(this).attr("name",smallName).css({"background-image":"url("+diversityBg+")"}).fadeIn("slow")});
			ASI=setTimeout(function(){autoShowImg("left")},5000);
			diversityHtml(jQuery("img[name="+smallName+"]"));
		}else{
			smallName=parseInt(bigName)+1;
			var diversityBg=jQuery("img[name="+smallName+"]").attr("src").replace("upfileS","upfileB");
			jQuery(".diversityBg").fadeOut("slow",function(){jQuery(this).attr("name",smallName).css({"background-image":"url("+diversityBg+")"}).fadeIn("slow")});
			ASI=setTimeout(function(){autoShowImg("right")},5000);
			diversityHtml(jQuery("img[name="+smallName+"]"));
			}
		}
	
	
	}
	
function newsIframe(){
	jQuery(".newsTitle a").click(function(){
		jQuery(".newsIframe b").html("新闻中心："+jQuery(this).text());
		jQuery(".newsIframe iframe").attr("src",jQuery(this).attr("href"));
		jQuery(".newsIframe").animate({width:"100%",height:"430px",top:"0px",left:"0px"}).fadeIn("slow");
		return false;
		})	
	}
function secondNewsIframe(){
	jQuery(".secondNewsTitle a").click(function(){
		jQuery(".newsIframe b",parent.parent.document).html("新闻中心："+jQuery(this).text());
	
		jQuery(".newsIframe iframe",parent.parent.document).attr("src","subWeb/"+jQuery(this).attr("href"));
		jQuery(".newsIframe",parent.parent.document).animate({width:"100%",height:"430px",top:"0px",left:"0px"}).fadeIn("slow");
		return false;
		})	
}

function closeNews(){
	jQuery(".newsIframe").fadeOut("slow",function(){jQuery(this).css({"width":"0px","height":"0px","top":"50%","left":"50%"})});
	}
	
function newsBig(){
	jQuery(".newText").css({"font-size":"20px","line-height":"25px"});
	}
	
function newsNormal(){
	jQuery(".newText").css({"font-size":"16px","line-height":"20px"});
	}
	
function newsSmall(){
	jQuery(".newText").css({"font-size":"12px","line-height":"20px"});
	}
	
function GetUrlParameter(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
   var r = window.location.search.substr(1).match(reg);
   if (r!=null) return unescape(r[2]); return null;
}

function showSecondPage(){
if(request("secondIframe")){
	
	jQuery(".secondLeftBg").css({"background-image":"url(images/"+request("secondIframe")+".jpg)"});
	jQuery(".secondIframe").attr("src","subWeb/"+request("secondIframe")+"/index.html");
	jQuery(".commercialBgImg").add(".tradeBgImg").add(".manufactBgImg").add(".realBgImg").add(".investmentBgImg").fadeOut("slow",function(){		
		jQuery(".secondPage").fadeIn("slow");
	});		
	
	}
jQuery(".commercialBgColor").fadeIn("slow",function(){
			jQuery(".commercialLeftTreeBg").animate({opacity:0.9,left:"0px"},1000,function(){
				jQuery(".commercialLeftTree").fadeIn("slow");
			});
		});

jQuery(".commercialLeftTreeBg img").click(function(){
	jQuery(".commercialLeftTree").fadeOut("slow",function(){
		jQuery(".commercialLeftTreeBg").animate({left:"-260px"},1000,function(){jQuery(".openCommercialLeftTree").fadeIn("slow")});	
			});
		});

jQuery(".openCommercialLeftTree").click(function(){
	jQuery(this).fadeOut("slow",function(){
			jQuery(".commercialLeftTreeBg").animate({opacity:0.9,left:"0px"},1000,function(){
				jQuery(".commercialLeftTree").fadeIn("slow");
			});
		});	
	});

jQuery(".commercialLeftTree a").click(function(){
	jQuery(".secondLeftBg").css({"background-image":"url(images/"+jQuery(this).attr("bg")+")"});
	jQuery(".secondIframe").attr("src",jQuery(this).attr("url")+"/index.html");
	jQuery(".commercialBgImg").add(".tradeBgImg").add(".manufactBgImg").add(".realBgImg").add(".investmentBgImg").fadeOut("slow",function(){		
		jQuery(".secondPage").fadeIn("slow");
	});		
})
	}

function demo(obj,height){
	saHeight=jQuery("."+obj).height();
	if(saHeight>height){
		   jQuery("."+obj).height(height)
		   var speed=50
		   var demo=document.getElementById("demo");
		   var demo1=document.getElementById("demo1");
		   var demo2=document.getElementById("demo2");
		   demo2.innerHTML=demo1.innerHTML
		   function Marquee(){
		   if(demo2.offsetTop-demo.scrollTop<=0)
		   demo.scrollTop-=demo1.offsetHeight
		   else{
		   demo.scrollTop++
		   }
		   }
		   var MyMar=setInterval(Marquee,speed)
		   demo.onmouseover=function() {clearInterval(MyMar)}
		   demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
	}
}

function footLine1(){
	jQuery(".footLine1 img").click(function(){
		jQuery(".secondCont").attr("src",jQuery(this).attr("url"));
	})
}

function footLine2(){
	jQuery(".footLine2 img").click(function(){
		window.open(jQuery(this).attr("url"),"_blank")
	})
}

function showSearch(){
	jQuery(".searchK").show().animate({right:"20px"}).find("input").val("搜索内容").focus(function(){
	if(jQuery(this).val()=="搜索内容"){
		jQuery(this).val("");
		}
	}).blur(function(){
	if(jQuery(this).val()==""){
		jQuery(this).val("搜索内容");
		}
	});
	jQuery(".closeSearchButton").show().click(function(){
	jQuery(this).hide();
	jQuery(".searchK").animate({right:"-200px"},function(){
	jQuery(this).hide();
	})
	});
	}
	
function ImageButton1_Click(){
jQuery("#otherPage").attr("src","news.aspx?title="+jQuery("#submit").val());
}
	
function request(paras){ 
var url = location.href;  
var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");  
var paraObj = {}  
for (i=0; j=paraString[i]; i++){  
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);  
}  
var returnValue = paraObj[paras.toLowerCase()];  
if(typeof(returnValue)=="undefined"){  
return "";  
}else{  
return returnValue; 
}
}

function openTianCheng(){	
	jQuery("#otherPage",parent.document).attr("src","manufacturing.aspx?secondIframe=tianchengchelun");	
	}
function openWanYuan(){
	jQuery("#otherPage",parent.document).attr("src","realEstate.aspx?secondIframe=yiyuandican");		
	}
function openKeYu(){
	jQuery("#otherPage",parent.document).attr("src","manufacturing.aspx?secondIframe=keyujinshu");
	}
function openDeBaoJinShou(){
	jQuery("#otherPage",parent.document).attr("src","manufacturing.aspx?secondIframe=debaojinshu");
	}
function openDeBaoGangGuan(){
	jQuery("#otherPage",parent.document).attr("src","manufacturing.aspx?secondIframe=debaogangguan");
	}
function openDiHuang(){
	jQuery("#otherPage",parent.document).attr("src","commercial.aspx?secondIframe=dihuang");
	}
function openYingJing(){
	jQuery("#otherPage",parent.document).attr("src","commercial.aspx?secondIframe=yingjing");
	}
function openQiaoDu(){
	jQuery("#otherPage",parent.document).attr("src","commercial.aspx?secondIframe=qiaodu");
	}
function openZhongHuan(){
	jQuery("#otherPage",parent.document).attr("src","commercial.aspx?secondIframe=zhonghuan");
	}
function openFuLaiLi(){
	jQuery("#otherPage",parent.document).attr("src","manufacturing.aspx?secondIframe=fulaili");
	}
function openYiChengJinShou(){
	jQuery("#otherPage",parent.document).attr("src","trade.aspx?secondIframe=yichengjinshu");
	}
