// JavaScript Document
//Written By Asimplefire
//2009-10-22

//menu bg switch
$(document).ready(function () {
    $("#ul_nav li a").mouseover(function () {
        if ($(this).text().length == 4) { $(this).addClass("onA_liCell_86") } else if ($(this).text().length > 8) { $(this).addClass("onA_liCell_104") };
    });
    $("#ul_nav li a").mouseout(function () {
        if ($(this).text().length == 4) { $(this).removeClass("onA_liCell_86") } else if ($(this).text().length > 8) { $(this).removeClass("onA_liCell_104") };
    });
    $("#barBodyLeft ul li b").mouseover(function () {
        $("#barBodyLeft ul li").removeClass("onLiChange"); $("#barBodyLeft ul li").addClass("barBodyLeft_ul_li"); $(this).parent().addClass("onLiChange");
        for (var i = 1; i < 5; i++) { $("#pb" + i).hide(); }
        $("#p" + $(this).attr("id")).show();
    });
    for (var i = 1; i < 5; i++) { $("#pb" + i).hide(); } $("#pb1").show();

    $(".a_href").click(function () { open("http://www.chongsoft.com/article_121.html", "_self") });

    //为广告banner2添加一个链接							
    $(".briefBanner").click(function () { open("http://www.ccseo.net/articles/Show-356.html", "_self") });
    $("#chongs_shouquan").click(function () { open("http://www.chongsoft.com/article_121.html", "_blank") });

    $("#download_32").click(function () { open("http://www.chongsoft.com/download/setup.exe", "_blank") });
    $("#download_64").click(function () { open("http://www.chongsoft.com/download/setup_x64.exe", "_blank") });


    $("#a_java").click(function () { open("http://www.java.com", "_blank") });
    $("#a_setup").click(function () { open("http://www.chongsoft.com/download/setup.exe", "_blank") });
    $("#a_pld").click(function () { open("http://bak.chongsoft.org/pld.zip", "_blank") });
    $("#a_qunding3").click(function () { open("http://bak.chongsoft.org/qunding3.exe", "_blank") });
    $("#a_en_qunding3").click(function () { open("http://bak.chongsoft.org/en_qunding3.exe", "_blank") });
    $("#a_wiki").click(function () { open("http://bak.chongsoft.org/wiki.zip", "_blank") });
    $("#a_wpmu").click(function () { open("http://bak.chongsoft.org/wpmu.zip", "_blank") });
    $("#a_g_zi").click(function () { open("http://bak.chongsoft.org/g.zip", "_blank") });
    $("#a_qj2").click(function () { open("http://bak.chongsoft.org/qj2.zip", "_blank") });
    $("#a_dvbbs2").click(function () { open("http://bak.chongsoft.org/dvbbs2.zip", "_blank") });

    
    $("#service1").click(function () { open("http://www.ccseo.net/articles/Show-307.html", "_blank") });
    $("#service2").click(function () { open("http://www.ccseo.net/articles/Show-282.html", "_blank") });
    $("#service3").click(function () { open("http://www.ccseo.net/articles/Show-276.html", "_blank") });
    $("#service4").click(function () { open("http://www.ccseo.net/peinews/", "_blank") });
    $("#service5").click(function () { open("http://www.ccseo.net/SEOPeiXun/SEO-Software-Training-5.htm", "_blank") });
    $("#service6").click(function () { open("http://www.ccseo.net/SEOPeiXun/SEO-Software-Training.htm", "_blank") });
    


    $(".down_32").click(function () { open("http://www.chongsoft.com/download/setup.exe", "_blank") });
    $(".down_64").click(function () { open("http://www.chongsoft.com/download/setup_x64.exe", "_blank") });

})

// the type of png pic transparent for IE6
function enablePngImages() {
 var imgArr = document.getElementsByTagName("IMG");
 for(i=0; i<imgArr.length; i++){
  if(imgArr[i].src.toLowerCase().lastIndexOf(".png") != -1){
   imgArr[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgArr[i].src + "', sizingMethod='auto')";
   imgArr[i].src = "http://www.ccseo.net/images/spacer.gif";
  }
  
  if(imgArr[i].currentStyle.backgroundImage.lastIndexOf(".png") != -1){
   var img = imgArr[i].currentStyle.backgroundImage.substring(5,imgArr[i].currentStyle.backgroundImage.length-2);
   imgArr[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
   imgArr[i].style.backgroundImage = "url(images/spacer.gif)";
  }
 }
}

function enableBgPngImages(){
 var bgElements=document.getElementsByTagName("DIV");
 for(i=0; i<bgElements.length; i++){
  if(bgElements[i].currentStyle.backgroundImage.lastIndexOf(".png") != -1&&bgElements[i].currentStyle.backgroundRepeat!="repeat-x"){
   //alert(bgElements[i]);
   var img = bgElements[i].currentStyle.backgroundImage.substring(5,bgElements[i].currentStyle.backgroundImage.length-2);
   bgElements[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
   bgElements[i].style.backgroundImage = "url(http://www.ccseo.net/images/spacer.gif)";
  }
 }
}

function transparentAllPng(){enablePngImages();enableBgPngImages();}
window.attachEvent("onload", transparentAllPng);

