﻿// JavaScript Document


//主菜单
function om(id){
	for(s=1;s<=20;s++){
		try{
			if(id==s){
				//alert(mn+s);
				document.getElementById('m'+s).src='img/index/m'+s+'_2.png';
			}
			else{
				document.getElementById('m'+s).src='img/index/m'+s+'_1.png';
			}
		}catch(e){}
	}
}


//通用代码
function ov(id,mn,dn,cls1,cls2){
	for(s=1;s<=20;s++){
		try{
			if(id==s){
				//alert(mn+s);
				document.getElementById(mn+s).className=cls1;
				document.getElementById(dn+s).style.display='block';
			}
			else{
				document.getElementById(mn+s).className=cls2;
				document.getElementById(dn+s).style.display='none';
			}
		}catch(e){}
	}
}

// 会员注册 鼠标事件
function reg_ov(id,cls){
	for(s=1;s<=20;s++){
		try{
			if(id==s){
				//alert(mn+s);
				document.getElementById(ln+s).style.display='block';
			}
			else{
				document.getElementById(ln+s).style.display='none'
			}
		}catch(e){}
	}
}

//会员输入框效果
function reg_ov(id,rn1){
	for(s=1;s<=20;s++){
		try{
			if(id==s){
				//alert(mn+s);
				document.getElementById(rn1+s).style.display='block';
			}
			else{
				document.getElementById(rn1+s).style.display='none'
			}
		}catch(e){}
	}
}


// 加入收藏夹   
function addCookie(){　 
    if (document.all){   
        window.external.addFavorite('http://www.e-chigo.com', '志高商城');   
    }else if (window.sidebar){   
        window.sidebar.addPanel('志高商城', 'http://www.e-chogo.com', "");   
    }   
}   


//通用Flash播件代码
function flash(src,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+src+'"><param name="quality" value="high"><param name="menu" value="false">');
document.write('<param name="wmode" value="transparent">');
document.write('<param name="allowFullScreen" value="true">');
document.write('<embed src="'+src+'" width="'+w+'" height="'+h+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>');
document.write(' </object>');
}

//首页中间大图广告代码
function index_ad(){
var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
//Iterate over the current set of matched elements
	var _titles = $("ul.slide-txt li");
	var _titles_bg = $("ul.op li");
	var _bodies = $("ul.slide-pic li");
	var _count = _titles.length;
	var _current = 0;
	var _intervalID = null;
	var stop = function() { window.clearInterval(_intervalID); };
	var slide = function(opts) {
		if (opts) {
			_current = opts.current || 0;
		} else {
			_current = (_current >= (_count - 1)) ? 0 : (++_current);
		};
		_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
			_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
			_bodies.removeClass("cur").eq(_current).addClass("cur");
		});
		_titles.removeClass("cur").eq(_current).addClass("cur");
		_titles_bg.removeClass("cur").eq(_current).addClass("cur");
	}; //endof slide
	var go = function() {
		stop();
		_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
	}; //endof go
	var itemMouseOver = function(target, items) {
		stop();
		var i = $.inArray(target, items);
		slide({ current: i });
	}; //endof itemMouseOver
	_titles.hover(function() { if($(this).attr('class')!='cur'){itemMouseOver(this, _titles); }else{stop();}}, go);
	//_titles_bg.hover(function() { itemMouseOver(this, _titles_bg); }, go);
	_bodies.hover(stop, go);
	//trigger the slidebox
	go();
}
