$(document).ready(function(){
	behzad.currentTab=1;
	behzad.currentTab2=1;
	behzad.switchTabs(1);
	behzad.switchTabs2(1);
	//------------------------------------------------------
	$("#searchBoxTextBox").live('keydown', function(e) {
        var key = e.which||e.keyCode;     
        //var key = (window.event) ? e.keyCode : e.which; 
        //var key = (window.event) ? window.event.keyCode : e.which; 
    if (key == 13) {
			theStr=document.getElementById("searchBoxTextBox").value;
			document.location.href="http://artostanha.ir/Default.aspx?page=14212&section=HSearchResult&mid=39083&keywords="+escape(theStr)+"&st=1";
			return false;
		}
   		return true;
	});
	//------------------------------------------------------
	setInterval(function(){
		behzad.slideBannerPics('forward',pix)	
	},5000);
	//------------------------------------------------------
	$("#uaIcon").mouseover(function(){
		$("#uaIcon").css("background-position","bottom");
	});
	$("#uaIcon").mouseout(function(){
		$("#uaIcon").css("background-position","top");
	});
	//------------------------------------------------------
	universalFlag='isON';
	$("#uaTile").animate({"width":"1px"},"fast");
	$("#uaIcon").click(function(){
		if(universalFlag=='isON'){
			$("#uaTile").animate({"width":"100px"},"slow");	
			universalFlag='isOFF';
			theTimeOut=setTimeout(function(){
				$("#uaTile").animate({"width":"0px"},"slow");	
				universalFlag='isON';
			},"5000");
		}else{
			$("#uaTile").animate({"width":"0px"},"slow");	
			universalFlag='isON';
		}
		
	});
	//------------------------------------------------------
	$("#topScrollerz").mouseover(function(){
		$(this).css("background-position","top right");		
	});
	$("#bottomScrollerz").mouseover(function(){
		$(this).css("background-position","top right");		
	});
	$("#topScrollerz").mouseout(function(){
		$(this).css("background-position","top left");		
	});
	$("#bottomScrollerz").mouseout(function(){
		$(this).css("background-position","top left");		
	});
	$("#topScrollerz").click(function(){
		$("#newzContz").animate({"scrollTop":"-=200"},"slow");	
	});
	$("#bottomScrollerz").click(function(){
		$("#newzContz").animate({"scrollTop":"+=200"},"slow");		
	});
	//------------------------------------------------------
	$("#tab2_1 div").html(tabTitle01);
	$("#tab2_2 div").html(tabTitle02);
	$("#tab2_3 div").html(tabTitle03);
	$("#tab2_4 div").html(tabTitle04);
	//------------------------------------------------------
	$("#tab1_title").html(tab01_title01);
	$("#tab1_lead").html(tab01_lead01);
	$("#tab2_title").html(tab01_title02);
	$("#tab2_lead").html(tab01_lead02);
	$("#tab3_title").html(tab01_title03);
	$("#tab3_lead").html(tab01_lead03);
	$("#tab4_title").html(tab01_title04);
	$("#tab4_lead").html(tab01_lead04);
	$("#tab5_title").html(tab01_title05);
	$("#tab5_lead").html(tab01_lead05);
	//------------------------------------------------------
	$("#tab-01").click(function(){behzad.switchTabs(1)});
	$("#tab-02").click(function(){behzad.switchTabs(2)});
	$("#tab-03").click(function(){behzad.switchTabs(3)});
	$("#tab-04").click(function(){behzad.switchTabs(4)});
	$("#tab-05").click(function(){behzad.switchTabs(5)});
	//-------------------------------------------------------
	$("#tab2_1").click(function(){behzad.switchTabs2(1)});
	$("#tab2_2").click(function(){behzad.switchTabs2(2)});
	$("#tab2_3").click(function(){behzad.switchTabs2(3)});
	$("#tab2_4").click(function(){behzad.switchTabs2(4)});
	//-------------------------------------------------------
	$("#tab-01").mouseover(function(){behzad.mouseOver(1)});
	$("#tab-01").mouseout(function(){behzad.mouseOut(1);});
	$("#tab-02").mouseover(function(){behzad.mouseOver(2);});
	$("#tab-02").mouseout(function(){behzad.mouseOut(2);});
	$("#tab-03").mouseover(function(){behzad.mouseOver(3);});
	$("#tab-03").mouseout(function(){behzad.mouseOut(3);});
	$("#tab-04").mouseover(function(){behzad.mouseOver(4);});
	$("#tab-04").mouseout(function(){behzad.mouseOut(4);});
	$("#tab-05").mouseover(function(){behzad.mouseOver(5);});
	$("#tab-05").mouseout(function(){behzad.mouseOut(5);});
	//-------------------------------------------------------
	//-------------------------------------------------------
	$("#tab2_1").mouseover(function(){behzad.mouseOver2(1)});
	$("#tab2_1").mouseout(function(){behzad.mouseOut2(1);});
	$("#tab2_2").mouseover(function(){behzad.mouseOver2(2);});
	$("#tab2_2").mouseout(function(){behzad.mouseOut2(2);});
	$("#tab2_3").mouseover(function(){behzad.mouseOver2(3);});
	$("#tab2_3").mouseout(function(){behzad.mouseOut2(3);});
	$("#tab2_4").mouseover(function(){behzad.mouseOver2(4);});
	$("#tab2_4").mouseout(function(){behzad.mouseOut2(4);});
	//-------------------------------------------------------
	$("#leftBtn").click(function(){behzad.slideBannerPics('backward',pix)});
	$("#rightBtn").click(function(){behzad.slideBannerPics('forward',pix)});
	//-------------------------------------------------------
	behzad.makeBannerPics(pix);
	behzad.slideBannerPics("forward",pix);
})
var behzad={
	currentTab:1,
	switchTabs:function(tab){
		behzad.currentTab=tab;
		switch(tab){
			case 1:
				bgPos=-500;
			break;
			case 2:
				bgPos=-375;
			break;
			case 3:
				bgPos=-250;
			break;
			case 4:
				bgPos=-125;
			break;
			case 5:
				bgPos=0;
			break;
		};
		$("#tab-01-right").css("backgroundPosition",bgPos);
		for(i=1;i<6;i++){
			if(tab==i){
				$("#tab"+i+"_lead").animate({opacity:0});
				$("#tab"+i+"_title").css("color","#00bc80");
				$("#tab"+i+"_title").animate({"fontSize":"13px"},"fast");
				$("#tab"+i+"_title").animate({"top":"15"},"fast");
				$("#tab"+i+"_title").animate({"left":"-7"},"fast");
				$("#tab"+i).fadeIn();
			}else{
				$("#tab"+i+"_lead").animate({opacity:1});
				$("#tab"+i+"_title").css("color","#7b7b52");
				$("#tab"+i+"_title").animate({"fontSize":"11px"},"fast");
				$("#tab"+i+"_title").animate({"top":"0"},"fast");
				$("#tab"+i+"_title").animate({"left":"0"},"fast");
				
				$("#tab"+i).hide();
			}
		}
		
	},
	mouseOver:function(tab){
		if(behzad.currentTab!=tab){
			$("#tab"+tab+"_lead").css("color","#7b7b52");
			//$("#tab"+tab+"_title").css("color","#00bc80");
		}	
	},
	mouseOut:function(tab){
		if(behzad.currentTab!=tab){
			$("#tab"+tab+"_lead").css("color","#c5c5a2");
			//$("#tab"+tab+"_title").css("color","#7b7b52");
		}	
	},
	switchTabs2:function(tab){
		behzad.currentTab2=tab;
		for(i=1;i<5;i++){
			if(i==tab){
				document.getElementById("tab2_"+i).className='tab2_on';
				$("#tab2_"+i).animate({"fontSize":"13px"},"fast");
				$("#tab22_"+i).fadeIn("slow");
			}else{
				var cssObject={
					"font-family":"Tahoma",
					"font-weight":"500",
					"color":"#c5c5a2",
					"background-position":"bottom"
				};
				$("#tab2_"+i).css(cssObject);
				document.getElementById("tab2_"+i).className='tab2_off';
				$("#tab2_"+i).animate({"fontSize":"11px"},"fast");
				$("#tab22_"+i).hide()
			}
		}
	},
	mouseOver2:function(tab){
		if(behzad.currentTab2!=tab){
			$("#tab2_"+tab).css("color","#7b7b52");
		}	
	},
	mouseOut2:function(tab){
		if(behzad.currentTab2!=tab){
			$("#tab2_"+tab).css("color","#c5c5a2");
		}	
	},
	makeBannerPics:function(array){
		theHtml="";
		for(i=0;i<array.length;i++){
			theHtml+="<div id='bannerPic"+i+"' style='background:url("+array[i]['pic']+");width:540px;height:182px;'><div id='topPicTitle' class='topPicTitle'>"+array[i]['title']+"</div></div>";
			$(".topBanner").html(theHtml);
			$(".topPicTitle").animate({"opacity":"0"},"fast");
			$(".topPicTitle").animate({"opacity":"0.7"},"slow");
		}
	},
	defaultBannerNumber:-1,
	slideBannerPics:function(where,array){
		if(where=='forward'){
			if(behzad.defaultBannerNumber>=(array.length-1)){
				behzad.defaultBannerNumber=0;
			}else{
				behzad.defaultBannerNumber++;
			}
		}else{
			if(behzad.defaultBannerNumber<=0){
				behzad.defaultBannerNumber=(array.length-1);
			}else{
				behzad.defaultBannerNumber--
			}
		}
		for(i=0;i<array.length;i++){
			if(i==behzad.defaultBannerNumber){
				$("#bannerPic"+i).fadeIn("slow");	
			}else{
				$("#bannerPic"+i).hide();
			}
		}
	}
};
$(document).ready(function(){
	ddsmoothmenu.init({mainmenuid: "smoothmenu1", orientation: 'v',	classname: 'ddsmoothmenu-v',contentsource: "markup"});
})


