﻿/*!
 * Site: website.com
 * Author: Author
 * Updated: 2010.01.01
 * Updated by: Lijian 
 * 
 */
/**
 * @method 多级菜单
 * Description
 * e.g menu('#nav');
 * @param string 导航的ID或者class表达式
 * @returns {param2} the value of the field, as set in the className
 */
function menu(nav){	
	$('li:has(> ul)',nav).addClass('parent');
	$('li:has(> ul) > a',nav).addClass('hasSubnav');
	$("li.parent",nav).hover(function(){
		$(this).addClass('on'); $('> a', this).addClass('hover'); 
	}, function(){
		$(this).removeClass('on'); $('> a', this).removeClass('hover'); 
	});
}
/**
 * @method 选项卡
 * Description
 * e.g tab(".nav",".content","on","mouseover");
 * @nav string 选项卡切换按钮外层的css表达式
 * @nav string 选项卡切换内容外层的css表达式
 * @nav string 当前选项的class名称
 */
function tab(nav,content,on,type)
{
	$(nav).children().bind(type,(function(){
		var tab=$(this);
		var tab_index=tab.prevAll().length;
		$(nav).children().removeClass(on);
		tab.addClass(on);
		$(content).children().hide();
		$(content).children().eq(tab_index).show();
	}));
}
function switchIndex(nav,content,on,index){
		var $tab=$(nav).children().eq(index);
		var $content = $(content).children();
		$(nav).children().removeClass(on);
		$(nav).children().removeClass("next");
		$tab.addClass(on);
		$tab.next().addClass("next");
		$content.hide();
		$content.eq(index).show();
		$('html,body').animate({
			scrollTop:676
		},1000);
}
/**
 * @method accordion
 * Description
 * e.g accordion(".nav",".content","on","mouseover");
 * @nav string 选项卡切换按钮外层的css表达式
 * @nav string 选项卡切换内容外层的css表达式
 * @nav string 当前选项的class名称
 */
function accordion(nav,content,on,type){
	$(nav).bind(type, function(){
		var $cur = $(this);	
		$(nav).removeClass(on);
		$(content).hide();
		$cur.addClass(on);
		$cur.next(content).fadeIn();
	})
}

/* Select */

function inputSelect(){
var g_DefaultText=[];
var g_DefaultTextColor=[];
var g_NormalTextColor=[];
var g_o_num=0; 

function setDefaultText(oInputElement, sDefaultText, sDefaultTextColor, sNormalTextColor)
{
	//save information in array
	g_DefaultText.push(sDefaultText);
	g_DefaultTextColor.push(sDefaultTextColor);
	g_NormalTextColor.push(sNormalTextColor);
	
	//set tip
	oInputElement.value=sDefaultText;
	oInputElement.style.color=sDefaultTextColor;
	
	//set switch
	oInputElement.isDefault=true;  
	oInputElement.index=g_o_num++;
	
	//add event
	oInputElement.onfocus=input_onFocus;
	oInputElement.onblur=input_onBlur;
}

function setText(oInputElement, text)
{
	oInputElement.isDefault=false;
	oInputElement.value=text;
	oInputElement.style.color=g_NormalTextColor[oInputElement.index];
}

function input_onFocus(event)
{
	if(this.isDefault)
	{
		this.value='';
		this.style.color=g_NormalTextColor[this.index];
	}
}


function input_onBlur(event)
{
	if(this.value.length)
	{
		this.isDefault=false;
	}
	else
	{
		this.isDefault=true;
		this.value=g_DefaultText[this.index];
		this.style.color=g_DefaultTextColor[this.index];
	}
}

$$=function(id)
{
   return "string" == typeof id ? document.getElementById(id) : id;   
}

window.onload=function ()
{
	var oInputKeyword=$$('keywordinput');
	setDefaultText(oInputKeyword, 'Enter Keywords or Item', '#ccc', '#000');
	
	var oInputEmail=$$('emailInput');
	setDefaultText(oInputEmail, 'Enter email address here', '#ccc', '#000');
	
}
}

inputSelect();


$(function(){



$(".scrollableDiv").click(function(){
$("#slideBox .myImages").show();
})


$(".scrollableDiv a:nth-child(1),.scrollableDiv a:nth-child(2),.scrollableDiv a:nth-child(9),.scrollableDiv a:nth-child(10)").click(
function(){
$("#slideBox .myImages").animate({left:234},800);
}
)

$(".scrollableDiv a:nth-child(3),.scrollableDiv a:nth-child(4),.scrollableDiv a:nth-child(11),.scrollableDiv a:nth-child(12)").click(
function(){
$("#slideBox .myImages").animate({left:0},800);
}
)

$(".scrollableDiv a:nth-child(5),.scrollableDiv a:nth-child(6),.scrollableDiv a:nth-child(13),.scrollableDiv a:nth-child(14)").click(
function(){
$("#slideBox .myImages").animate({left:235},800);
}
)

$(".scrollableDiv a:nth-child(7),.scrollableDiv a:nth-child(8),.scrollableDiv a:nth-child(15),.scrollableDiv a:nth-child(16)").click(
function(){
$("#slideBox .myImages").animate({left:470},800);
}
)

})




