// JavaScript Document
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setArtistUrl(url){
	var a = document.getElementById("artistlink");
	a.href=url;
}

function setOriUrl(url){
	var a = document.getElementById("orilink");
	a.href=url;
}

///////////////////////////////////////////////
function getArtistImage(){
	var image = new Array(6);
	image [0] = 'images/cep.jpg';
	image [1] = 'images/ljw.jpg';
	image [2] = 'images/xbh.jpg';
	image [3] = 'images/xlm.jpg';
	image [4] = 'images/yxn.jpg';
	image [5] = 'images/zzy.jpg';
	
	var urls = new Array(6);
	urls [0] = 'http://www.artnetworking.com/artist_detial.asp?authorid=CaiErPing11:52:33 PM';
	urls [1] = 'http://www.artnetworking.com/artist_detial.asp?authorid=LiangJunWu3:28:41 AM';
	urls [2] = 'http://www.artnetworking.com/artist_detial.asp?authorid=HsuJessicaPiHua022912-9521';
	urls [3] = 'http://www.artnetworking.com/artist_detial.asp?authorid=XuanLiMin3793327049';
	urls [4] = 'http://www.artnetworking.com/artist_detial.asp?authorid=YangXueNing4:33:22%20AM';
	urls [5] = 'http://www.artnetworking.com/artist_detial.asp?authorid=ZhouZhongYao10:11:51%20PM';
	
	var imgOriArt = new Array(6);
	//imgOriArt [0] = 'images/ssj2.jpg';
	imgOriArt [0] = 'images/xbhzp.jpg';
	imgOriArt [1] = 'images/cepzp.jpg';
	imgOriArt [2] = 'images/ljwoa.jpg';
	imgOriArt [3] = 'images/yxnoa.jpg';
	imgOriArt [4] = 'images/zzyoa.jpg';
	imgOriArt [5] = 'images/xlmoa.jpg';
	
	var oa_urls = new Array(6);
	oa_urls [0] = 'http://www.artnetworking.com/or_detial.asp?authorid=HsuJessicaPiHua022912-9521&path=43857&group=2';
	oa_urls [1] = 'http://www.artnetworking.com/or_detial.asp?authorid=CaiErPing11:52:33 PM&path=43856&group=3';
	oa_urls [2] = 'http://www.artnetworking.com/or_detial.asp?authorid=LiangJunWu3:28:41%20AM&path=43039&group=1';
	oa_urls [3] = 'http://www.artnetworking.com/or_detial.asp?authorid=YangXueNing4:33:22%20AM&path=43594&group=1';
	oa_urls [4] = 'http://www.artnetworking.com/or_detial.asp?authorid=ZhouZhongYao10:11:51%20PM&path=42886&group=2';
	oa_urls [5] = 'http://www.artnetworking.com/or_detial.asp?authorid=XuanLiMin3793327049&path=43847&group=2';
	
	number = Math.floor(Math.random() * image.length);
        number2 = Math.floor(Math.random() * imgOriArt.length);
	
	MM_swapImage("imgArtist","",image[number],1);
	setArtistUrl(urls[number]);
	MM_swapImage("imgOriArt","",imgOriArt[number2],1);
	setOriUrl(oa_urls[number2]);
}

function selTab(ulId, tabDivs, indexClick, selfObj) {
	var elementUl = document.getElementById(ulId);
	var elementLis = null;
	if (elementUl) {
		elementLis = elementUl.getElementsByTagName("li");
		
		for (var i = 0; i < elementLis.length; i ++) {
			//elementLis[i].setAttribute("class", "");
			//elementLis[i].setAttribute("className", "");
			
			document.getElementById(tabDivs + (i+1)).style.display = "none";
		}
		//selfObj.setAttribute("class","liSelected");
		//selfObj.setAttribute("className","liSelected");
		
		document.getElementById(tabDivs + indexClick).style.display = "block";
	}
}

var t = n = count = 0;   
$(function(){   
    count = $("#play_list a").size();   
    $("#play_list a:not(:first-child)").hide();   
    //$("#play_info").html($("#play_list a:first-child").find("img").attr('alt'));   
    $("#play_text li:first-child").css({"background-image":"url('../images/num_btn2.png')",'color':'#ffffff','line-height':'19px'});   
    //$("#play_info").click(function(){window.open($("#play_list a:first-child").attr('href'), "_blank")});   
    $("#play_text li").click(function() {   
        var i = $(this).text() - 1;   
        n = i;   
        if (i >= count) return;   
        //$("#play_info").html($("#play_list a").eq(i).find("img").attr('alt'));   
        //$("#play_info").unbind().click(function(){window.open($("#play_list a").eq(i).attr('href'), "_blank")})   
        $("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);   
        $(this).css({"background-image":"url('../images/num_btn2.png')",'color':'#ffffff'}).siblings().css({"background-image":"url('../images/num_btn1.png')",'color':'#ffffff'});   
    });   
    t = setInterval("showAuto()", 6000);   
    $("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 6000);});   
})   
  
function showAuto()   
{   
    n = n >= (count - 1) ? 0 : n + 1;   
    $("#play_text li").eq(n).trigger('click');   
}   

/*
function signup() {
	var n = document.getElementById("txtUserName");
	var p = document.getElementById("txtPwd");
	var r = document.getElementById("txtPwdRpt");
	
	if (n != null) || (n.value == "") {
		//alert("Fields marked with an asterisk are required.");
		//n.focus();
	}
	else if (p != null) || (p.value == "") {
		alert("Fields marked with an asterisk * are required.");
		p.focus();
	}
	else if (r != null) || (r.value == "") {
		alert("Fields marked with an asterisk * are required.");
		txtPwdRpt.focus();
	}
	else if ((p != null) && (r != null) && (p.value != r.value)) {
		alert("Confirm password error, please try again.");
		p.focus();
	}
	else {
		//MM_findObj("frmMemberSignup").submit();
	}
}
*/
