// JavaScript Document
	$(function(){
$('#marquee1').kxbdSuperMarquee({
				distance:142,
				time:3,
				btnGo:{left:'#goL',right:'#goR'},
				direction:'left'
			});
					});
//banner轮换js

$(document).ready(function() {

	//Set Default State of each portfolio piece
	$(".paging").show();
	$(".paging a:first").addClass("active");
		
	//Get size of images, how many there are, then determin the size of the image reel.
	var imageWidth = $(".window").width();
	var imageSum = $(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$(".image_reel").css({'width' : imageReelWidth});
	
	//Paging + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$(".paging a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		$(".image_reel").animate({ 
			left: -image_reelPosition
		}, 500 );
		
	}; 
	
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.paging a.active').next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.paging a:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 7000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$(".image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	
	
	//On Click
	$(".paging a").click(function() {	
		$active = $(this); //Activate the clicked paging
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});	
	
});

//加入收藏 设为首页 js

function addCookie(){// 加入收藏  
 if (document.all){  
 window.external.addFavorite('http://www.hangxunkeji.com', '天津市航讯科技开发集团有限公司');  
 }  
 else if (window.sidebar){  
 window.sidebar.addPanel('天津市航讯科技开发集团有限公司','http://www.hangxunkeji.com', "");  
 }  
 }  
 function setHomepage(){　 // 设为首页  
 if (document.all) {  
 document.body.style.behavior = 'url(#default#homepage)';  
 document.body.setHomePage('http://www.hangxunkeji.com');  
 }  
 else if(window.sidebar){  
 if (window.netscape){  
 try {  
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
 }  
 catch(e){  
alert("该操作被浏览器拒绝，假如想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");  
 }  
}  
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);  
 prefs.setCharPref('browser.startup.homepage','http://www.hangxunkeji.com');  
 }  
 }  
 
