$.fn.extend({
	allenMenu: function() {
		$(this).children('ul').children('li').hover(
			function() {
				if(!$(this).children('ul').hasClass('focus')) {
					$(this).addClass('focus');
					$(this).children('ul:first').stop(true, true).animate({ height:'show' }, 'fast');
				}
			},
			function() {
				$(this).removeClass('focus');
				$(this).children('ul:first').stop(true, true).animate({ height:'hide', opacity:'hide' }, 'slow');
			}
		);
		$(this).children('ul').children('li').children('ul').hover(
			function() {
				$(this).addClass('focus');
			},
			function() {
				$(this).removeClass('focus');
			}
		);
	}
});

$.fn.extend({
	allenSlide: function() {
		var ads = $(this).find('ul:first li');
		var name = $(this).attr('id');
		var n = ads.length;
		var w = ads.width(0);
		var h = ads.height();
		var clicked = false;
		var t = 4000;
		var lt = 5000;
		var speed = 'slow';
		var curPage = 0;
		
		//$(this).children('ul:first').append($(this).find('ul:first li:first').clone());
		
		$(this).width(w).height(h);
		$(this).css('overflow', 'hidden');
		$(this).css('position', 'relative');
		$(this).children('ul:first').width(w * (n + 1));
		var pages = $('<div class="slide-page"></div>');
		for(var i = 1; i <= n; i++) {
			var el = $('<a href="#" id="' + name + '-page-' + i + '">' + i + '</a>');
			eval('el.click(function(){ clicked = true; slideTo(' + i + '); return false; });');
			pages.append(el);
		}
		$(this).append(pages);
		$('#' + name + '-page-1').parent().addClass('on');
		autoSlide();
		
		/* Fade Version
		*/
		function slideTo(page) {
			curPage = page;
			var ml = -1 * w * (page - 1);
			$('#' + name).find('li:eq('+(curPage-1)+')').stop();
			if(page > n) {
				page = 1;
				curPage = 1;
			}
			$('#' + name).find('li').each(function() {
				if($(this).css("display") != "none") {
					//$(this).css('z-index', '2');
					$(this).fadeOut(speed);
				}
			});
			//$('#' + name).find('li:eq('+(page-1)+')').css('z-index', '1');
			$('#' + name).find('li:eq('+(page-1)+')').fadeIn(speed);
			$('#' + name).find('.slide-page > a').removeClass('on');
			$('#' + name + '-page-' + curPage).addClass('on');
		}

		/* Slide Version
		function slideTo(page) {
			curPage = page;
			var ml = -1 * w * (page - 1);
			$('#' + name).children('ul:first').stop();
			if(page > n) {
				curPage = 1;
			} else if(page == 2 && !clicked) {
				$('#' + name).children('ul:first').css('margin-left', '0px');
			}
			$('#' + name).children('ul:first').animate({ marginLeft: ml }, speed);
			$('#' + name).find('.slide-page > a').removeClass('on');
			$('#' + name + '-page-' + curPage).addClass('on');
		}
		*/
		
		function autoSlide() {
			var tp = curPage;
			if(!clicked) {
				slideTo(tp + 1);
				eval('setTimeout(function() { autoSlide(); }, ' + t + ');');
			} else {
				clicked = false;
				eval('setTimeout(function() { autoSlide(); }, ' + lt + ');');
			}
		}

	}
});
$(document).ready(function() {
			$('#main_nav').allenMenu();
			$('#slide').allenSlide();
		});



	
	
	
//企业荣誉点击出现大图
var scrollPos

function showpic(ob,obwidth,obheight)
{
if (typeof window.pageYOffset != 'undefined') {
	   scrollPos = window.pageYOffset;
		}
		else if (typeof document.compatMode != 'undefined' &&
					 document.compatMode != 'BackCompat') {
		   scrollPos = document.documentElement.scrollTop;
		}
		else if (typeof document.body != 'undefined') {
				   scrollPos = document.body.scrollTop;
		}
	scrollPos=scrollPos+250
var allbox=document.getElementById("allbox")
if(allbox!==null)
{
	document.body.removeChild(allbox)
}
var screenwidth=(document.body.scrollWidth)
var newlayer=document.createElement("div")
newlayer.style.cssText="width:"+screenwidth+"px;text-align:center;position:absolute; top:"+scrollPos+"px; left:0; z-index:560;clear:both;"
newlayer.setAttribute("id","allbox")

var ahref=document.createElement("a")
ahref.setAttribute("href","#")
ahref.style.cssText="border:none;"

var pic=document.createElement("img")
pic.setAttribute("src",ob)
pic.style.cssText="width:"+obwidth+"px;height:"+obheight+"px; border:1px solid #cccccc;margin:0 auto;"
pic.onclick=function()
{
document.body.removeChild(newlayer)
return false;
}

var pic_box=document.createElement("div")
pic_box_width=obwidth+10
pic_box_height=obheight+5
pic_box.style.cssText="width:"+pic_box_width+"px;height:"+pic_box_height+"px; margin:0 auto;"
ahref.appendChild(pic)
pic_box.appendChild(ahref)
newlayer.appendChild(pic_box)
document.body.appendChild(newlayer)

}



//搜索提示文字
function shuru(){
		document.getElementById("sozi").value="";
	}
	
	function shuru1(){
		document.getElementById("textname").value="";
	}
	
function shurua(){
		document.getElementById("textname").value="";
	}
	
function shurub(){
		document.getElementById("texttell").value="";
	}
	
	function shurub2(){
		document.getElementById("texttell").value="";
	}
	
	
	function shurub1(){
		document.getElementById("textpost").value="";
	}
	
function shuruc(){
		document.getElementById("textemail").value="";
	}
	
	function shuruc5(){
		document.getElementById("textaddress").value="";
	}
	function shuruc4(){
		document.getElementById("textemail").value="";
	}
function shuruc1(){
		document.getElementById("textaddress").value="";
	}
	
function shurud(){
		document.getElementById("textcontent").value="";
	}
	
	function shurud1(){
		document.getElementById("textaddres").value="";
	}
	
	function shurub3(){
		document.getElementById("textpost").value="";
	}
	
	
function shurue(){
		document.getElementById("textbank").value="";
	}
	
function shuruf(){
		document.getElementById("sozif").value="";
	}
	
function shurug(){
		document.getElementById("sozig").value="";
	}
	
function shuruh(){
		document.getElementById("sozih").value="";
	}
	
function shurui(){
		document.getElementById("textcontent").value="";
	}
	

