function toggleHeadMenu(menuname, over)
{   
    var obj = document.getElementById('menuname');   
	alert(obj);
    if(over) {
       // obj.addClass('over');
     //  obj.style.display = '';  
       obj.style.left = '3px';
    }
    else {
     //   obj.removeClass('over');
       obj.style.left = '3px';      
    }
}

function check()
{
    var strst3 = $("#attrib-1 option:selected").text();
    if(strst3=='Please Select Size')
    {
          alert("Please Select Your Size");
        return false;
    }
    true;  
}

function showcategory(cid){  
        var obj = document.getElementById('ulid_'+cid);
        if(obj.style.display == 'none'){
            HiddenAllCategories();
            obj.style.display = 'block';   
        }else{
            obj.style.display = 'none';
        }
}
                            
function ShowCategories(faqid){
        var obj = document.getElementById('show_content'+faqid);
        if(obj.style.display == 'none'){
            obj.style.display = 'block';   
        }else{
            obj.style.display = 'none';
        }
}

function HiddenAllCategories(){
        var e = document.getElementsByTagName('ul');
        for(var i = 0; i < e.length; i++){
            if (e[i].id.substr(0,4) == 'ulid'){
                e[i].style.display = 'none';
            }
        }   
}

/*
function getScroll(ContentId,ContentId1,ContentId2,speed)
{
    var scrollContent = document.getElementById(ContentId);
    var scrollContent1 = document.getElementById(ContentId1);
    var scrollContent2 = document.getElementById(ContentId2);
    var speed=speed;    //滚动速度值，值越大速度越慢
    var nnn=200/scrollContent1.offsetHeight;
    //for(i=0;i<nnn;i++){scrollContent1.innerHTML+="<br />"+ scrollContent1.innerHTML}
    scrollContent2.innerHTML=scrollContent1.innerHTML;    //克隆demo2为demo1
    function Marquee(){ 
        if(scrollContent2.offsetHeight-scrollContent.scrollTop<=0)     //当滚动至demo1与demo2交界时
            scrollContent.scrollTop-=scrollContent1.offsetHeight          //demo跳到最顶端
        else{ 
            scrollContent.scrollTop++                              //如果是横向的 将 所有的 height top 改成 width left 
        } 
    } 
    var MyMar=setInterval(Marquee,speed);                     //设置定时器
    scrollContent.onmouseover=function() {clearInterval(MyMar)} //鼠标经过时清除定时器达到滚动停止的目的
    scrollContent.onmouseout=function() {MyMar=setInterval(Marquee,speed)} //鼠标移开时重设定时器
}
*/

jQuery.fn.floatdiv=function(location){
    var isIE6=false;
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : 0;
    if(Sys.ie && Sys.ie=="6.0"){
        isIE6=true;
    }
    var windowWidth,windowHeight;
    if (self.innerHeight) {
        windowWidth=self.innerWidth;
        windowHeight=self.innerHeight;
    }else if (document.documentElement&&document.documentElement.clientHeight) {
        windowWidth=document.documentElement.clientWidth;
        windowHeight=document.documentElement.clientHeight;
    } else if (document.body) {
        windowWidth=document.body.clientWidth;
        windowHeight=document.body.clientHeight;
    }
    return this.each(function(){
        var loc;
        var wrap=$("<div></div>");
        var top=-1;
        if(location==undefined || location.constructor == String){
            switch(location){
                case("rightbottom"):
                    loc={right:"0px",bottom:"0px"};
                    break;
                case("leftbottom"):
                    loc={left:"0px",bottom:"0px"};
                    break;    
                case("lefttop"):
                    loc={left:"0px",top:"0px"};
                    top=0;
                    break;
                case("righttop"):
                    loc={right:"0px",top:"0px"};
                    top=0;
                    break;
                case("middletop"):
                    loc={left:windowWidth/2-$(this).width()/2+"px",top:"0px"};
                    top=0;
                    break;
                case("middlebottom"):
                    loc={left:windowWidth/2-$(this).width()/2+"px",bottom:"0px"};
                    break;
                case("leftmiddle"):
                    loc={left:"0px",top:windowHeight/2-$(this).height()/2+"px"};
                    top=windowHeight/2-$(this).height()/2;
                    break;
                case("rightmiddle"):
                    loc={right:"0px",top:windowHeight/2-$(this).height()/2+"px"};
                    top=windowHeight/2-$(this).height()/2;
                    break;
                case("middle"):
                    var l=0;
                    var t=0;
                    l=windowWidth/2-$(this).width()/2;
                    t=windowHeight/2-$(this).height()/2;
                    top=t;
                    loc={left:l+"px",top:t+"px"};
                    break;
                default:
                    location="rightbottom";
                    loc={right:"0px",bottom:"0px"};
                    break;
            }
        }else{
            loc=location;
            var str=loc.top;
            str=str.replace("px","");
            top=str;
        }
		
        /*fied ie6 css hack*/
        if(isIE6){
            if (top>=0)
            {
                wrap=$("<div style=\"top:expression(documentElement.scrollTop+"+top+");\"></div>");
            }else{
                wrap=$("<div style=\"top:expression(documentElement.scrollTop+documentElement.clientHeight-this.offsetHeight);\"></div>");
            }
        }
        $("body").append(wrap);
        wrap.css(loc).css({position:"fixed",
            z_index:"999"});
        if (isIE6)
        {
            
            wrap.css("position","absolute");             
            $("body").css("background-attachment","fixed").css("background-image","url(n1othing.txt)");
        }
        $(this).appendTo(wrap);
    });
};

/*
$(document).ready(function() { 
    getScroll("scrollContent","scrollContent1","scrollContent2",40);   
    $(function(){
        $("#msnchat").floatdiv({right:"10px",top:"50px"});
    });
 }); 
*/



function characterCount(field, count, maxchars) {
  var realchars = field.value.replace(/\t|\r|\n|\r\n/g,'');
  var excesschars = realchars.length - maxchars;
  if (excesschars > 0) {
        field.value = field.value.substring(0, maxchars);
        alert("Error:\n\n- You are only allowed to enter up to"+maxchars+" characters.");
    } else {
        count.value = maxchars - realchars.length;
    }
}
