// JavaScript Document
jQuery(function ($) {

	//蓝色边栏智能浮动
	$(".inner_nav").smartFloat();
	
	//得到当前页面URL
	var pageUrl = window.location.href.toString();
	var urls = pageUrl.split("/");
	
	//加载网页底部、主导航栏（并判断当前页面，改变当前页面链接状态）、次导航栏
	$.get("/foot.html", {}, function(data){
		$(".foot").html(data);
	});
	$.get("/navigation1.html", {}, function(data){
		$(".nav1").html(data);
		$(".nav1 li a").removeClass("link_nav1_selected");
		switch (urls[3])
		{
			case "index.html":
				$("#n0").addClass("link_nav1_selected");
				break;
			case "about":
				$("#n1").addClass("link_nav1_selected");
				break;
			case "app":
				$("#n2").addClass("link_nav1_selected");
				break;
			case "product":
				$("#n3").addClass("link_nav1_selected");
				break;
			case "inquiry":
				$("#n4").addClass("link_nav1_selected");
				break;
			default:
				$("#n0").addClass("link_nav1_selected");
				break;
		}
	});
	$.get("/navigation2.html", {}, function(data){
		$(".inner_nav").html(data);
	});

	//提醒挨千刀的IE6用户升级浏览器
	$(".all").after("<!--end footer_background_image--><!--[if lt IE 8]> <div style=' clear: both; height: 59px; width: 1020px; padding:0 0 0 0; position: relative; z-index:10;'> <a href='http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode'><img class='upgrade_icon' src='/images/upgrade.jpg' border='0' height='32' width='1020' alt='亲，为什么你还在用IE6？不安全速度慢甚至微软都停止了新，有木有！为了更好更安全的网络环境，请升级浏览器至IE8/9、Chrome或火狐！' /></a></div><![endif]-->");
		
	//为了让挨千刀的IE6支持浮动元素的100%高度布局，只好用挨千刀的JS来实现了
	if(isie6())
	{
		$(".blue_menu_outter").height( $(document).height());
	}else{
		$(".blue_menu_outter").position("fix");
	}
		
	$(".blue_menu_innner").hover(function(e){
		$(this).parent().animate({
						width:223
						},400,"swing");	
		$(this).animate({
						width:201
						},400,"swing");	
		$(".inner_nav").animate({
						left:15
						},400,"swing");	
	}, function(e){
		$(this).parent().clearQueue();
		$(this).clearQueue();
		$(this).parent().animate({
						width:49
						},400,"swing");	
		$(this).animate({
						width:27
						},400,"swing");	
		$(".inner_nav").animate({
						left:-150
						},400,"swing");	
	});
	
	$(".link_subsite").hover(function(e){
		$(this).clearQueue();
		$(this).children(".layer2").fadeOut("slow");
	}, function(e){
		$(this).children(".layer2").fadeIn("slow");
	});
	
	DD_belatedPNG.fix("img, .logo, .head, .blue_menu_innner, .blue_menu_outter, .ad img, .ad_right_icon, .ad_left_icon, .last_project_left, .last_project_right, .foot, .right_logo, .appstore, .appstore_small, .inquiry_content, .inquiry_submit, .inner_nav, ");
	
});

function GetPageScroll() 
{
  var x, y;
  if(window.pageYOffset) 
  {
    // all except IE
    y = window.pageYOffset;
    x = window.pageXOffset;
  } else if(document.documentElement 
    && document.documentElement.scrollTop) 
	{
    // IE 6 Strict
    y = document.documentElement.scrollTop;
    x = document.documentElement.scrollLeft;
  } else if(document.body) 
  {
    // all other IE
    y = document.body.scrollTop;
    x = document.body.scrollLeft; 
  }
  return {X:x, Y:y};
}

function isie6() {
    if ($.browser.msie) {
        if ($.browser.version == "6.0") return true;
    }
    return false;
}
$.fn.smartFloat = function() { var position = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls > top) { if (window.XMLHttpRequest) { element.css({ position: "fixed", top: 0 }); } else { element.css({ top: scrolls }); } }else { element.css({ position: "absolute", top: top }); } }); }; return $(this).each(function() { position($(this)); });};
