 var firstLoad=false;
var direction=-1;
var timeOut=null;
function getFileFromURL(){
	var file="";
	var url=window.location+"";
	if(url.indexOf("?")>=0&&url.indexOf("=")<url.length-1)
		file=url.substr(url.lastIndexOf("=")+1,url.length-1);
	if(file&&file.indexOf(".flv")<0)	
		file+=".flv"; 
	return file;	
}
 function trim(str, chars) {
		chars = chars || "\\s";
		str= str.replace(new RegExp("^[" + chars + "]+", "g"), "");
		str= str.replace(new RegExp("[" + chars + "]+$", "g"), "");
		return str
	}
function removeTrailingSpaces(arg) {
	if(!arg)
		return "";
	while(''+arg.charAt(arg.length-1)==' ') { arg=arg.substring(0,arg.length-1); }
	return(arg);
}

function createplayer(go,url, showImg) {
 	document.getElementById("wrapper").style.top=69+"px"; 
  	if (!url) { theFile="image/product0.gif"; }
	else { theFile=url; } 
    var theWidth=310; 
	var theHeight=255; 
    var theDisplayheight=255;
 	
 	var s = new SWFObject("/flash/mediaplayer.swf", "playerID", theWidth, theHeight, "7");
	s.addParam("allowfullscreen", "true");
	s.addVariable("usefullscreen","true");
	s.addVariable("file", encodeURIComponent(theFile));
	s.addVariable("width", theWidth);
	s.addVariable("height", theHeight);
	s.addVariable("displayheight", theDisplayheight);
	s.addVariable("overstretch", "fit");
	s.addVariable("showicons", true);
	//s.addVariable("quality", "high"); 
	s.addParam('allowscriptaccess','always'); 
	s.addParam('stretching','fill');  
	s.addVariable("shuffle","false"); 
	s.addVariable("enablejs","true"); 
	s.addVariable("javascriptid","playerID");  
	 
	if (go) { s.addVariable("autostart", "true"); }
	s.write("placeholder"); 
	//alert(document.getElementById("placeholder").innerHTML);
}
 
 

 function imagescroller( v,j,I,G,Q,H){
	this.S=j;this.Q=Q;this.A=12;this.g=0;this.f=0;this.F=10;
	this.B=0;
	this.c=0;
	var o=v.length;
	while(v.length<this.A){var ol=v.length;for(var i=0;i<o;i++){v[ol+i]=v[i];}}
	this.v=v;
	 
  
	document.write('<table cellspacing='+Q+' cellpadding=0 border=0   width="100%"  bgcolor="#DFEAFE">');
 	document.write('<tr>');
	document.write('<td width=1 style="cursor:pointer;" onMouseDown="if(!firstLoad){'+j+'.c=0;'+j+'.m(); window.setTimeout(time=function(){'+j+'.m(0);},600)}else{'+j+'.l(0);}return true;" onMouseUp="firstLoad=true;'+j+'.c=0;'+j+'.m();return true;"  onClick="return false;">');
	document.write('<img src="wp-content/themes/shodex/images/slide_left.gif" onMouseDown="this.src=\'wp-content/themes/shodex/images/slide_left2.gif\'" onMouseUp="this.src=\'wp-content/themes/shodex/images/slide_left.gif\'" onMouseOut="this.src=\'wp-content/themes/shodex/images/slide_left.gif\'">');
	document.write('</td>');
	document.write('<td width=100%>');
	document.write('<div id="'+j+'" style="position:relative;overflow:hidden;width=100%;  height:126px;">');
	for(var i=0;i<v.length;i++){
		document.write('<div style="position: absolute;cursor:pointer;left:-500px;" id="'+j+i+'"><img src="'+v[i]+'" height=126 onclick="'+j+'.J('+i+',event);"></div>');}
	document.write('</div>');
	document.write('</td>');
	document.write('<td width=5 class="Navigator" style="cursor:pointer;" onMouseDown="'+j+'.l(1);return true;" onMouseUp="firstLoad=true;'+j+'.c=0;'+j+'.m();return true;" onClick="return false;">');
	document.write('<img src="wp-content/themes/shodex/images/slide_right.gif" onMouseDown="this.src=\'wp-content/themes/shodex/images/slide_right2.gif\'" onMouseUp="this.src=\'wp-content/themes/shodex/images/slide_right.gif\'" onMouseOut="this.src=\'wp-content/themes/shodex/images/slide_right.gif\'">');
	document.write('</td>');
	document.write('</tr>');
	document.write('</td></tr>');  
		 
	document.write('</table>');var M=this;if(window.addEventListener)window.addEventListener("load",function(){M.z()},false);else if(window.attachEvent)window.attachEvent("onload",function(){M.z()});else if(document.getElementById) {clearTimeout(timeOut);timeOut=setTimeout(function(){M.z()},500);}};imagescroller.prototype.z=function(){var M=this;M.w()};imagescroller.prototype.w=function(){var n,t,r;r=this.v.length>this.A?this.A:this.v.length;for(var i=0;i<r;i++){n=i+this.g<this.v.length?i+this.g:0-(this.v.length-(i+this.g));t=n-1>=0?n-1:this.v.length-1;if(i==0){document.getElementById(this.S+n).style.left='0px';}else if(i==r-1){if(this.g>0){document.getElementById(this.S+(this.g-1)).style.left=parseInt(document.getElementById(this.S+this.g).style.left)-document.getElementById(this.S+(this.g-1)).offsetWidth-this.Q;}else{document.getElementById(this.S+(this.v.length-1)).style.left=parseInt(document.getElementById(this.S+this.g).style.left)-document.getElementById(this.S+(this.v.length-1)).offsetWidth-this.Q;}}else{document.getElementById(this.S+n).style.left=parseInt(document.getElementById(this.S+t).style.left)+document.getElementById(this.S+t).offsetWidth+this.Q;}}};imagescroller.prototype.O=function(){var M=this;if(0-parseInt(document.getElementById(this.S+this.g).style.left)>document.getElementById(this.S+this.g).offsetWidth){this.g=this.g+1>=this.v.length?0:this.g+1;M.w();if(this.f==1){this.d=setTimeout(function(){M.O()},this.c);}}else{clearTimeout(timeOut);timeOut=setTimeout(function(){M.D()},this.B);}};
	imagescroller.prototype.D=function(){
		var r=this.v.length>this.A?this.A:this.v.length;
		for(var i=0;i<r;i++){var n=i+this.g<this.v.length?i+this.g:0-(this.v.length-(i+this.g));
		if(i==r-1){if(this.g>0){
			document.getElementById(this.S+(this.g-1)).style.left=parseInt(document.getElementById(this.S+(this.g-1)).style.left)-this.F;}
		else{document.getElementById(this.S+(this.v.length-1)).style.left=parseInt(document.getElementById(this.S+(this.v.length-1)).style.left)-this.F;}}
		else{document.getElementById(this.S+n).style.left=parseInt(document.getElementById(this.S+n).style.left)-this.F;}
		}
		var M=this;
		clearTimeout(timeOut);timeOut=setTimeout(function(){M.O()},this.B);};imagescroller.prototype.N=function(){ var M=this;var t=this.g-1>=0?this.g-1:this.v.length-1;if(parseInt(document.getElementById(this.S+t).style.left)>0){this.g=this.g-1>=0?this.g-1:this.v.length-1;M.w();if(this.f==1){this.d=setTimeout(function(){M.N()},this.c);}}else{clearTimeout(timeOut);timeOut=setTimeout(function(){M.C()},this.B);}};imagescroller.prototype.C=function(){var r=this.v.length>this.A?this.A:this.v.length;for(var i=0;i<r;i++){var n=i+this.g<this.v.length?i+this.g:0-(this.v.length-(i+this.g));if(i==r-1){if(this.g>0){document.getElementById(this.S+(this.g-1)).style.left=parseInt(document.getElementById(this.S+(this.g-1)).style.left)+this.F;}else{document.getElementById(this.S+(this.v.length-1)).style.left=parseInt(document.getElementById(this.S+(this.v.length-1)).style.left)+this.F;}}else{document.getElementById(this.S+n).style.left=parseInt(document.getElementById(this.S+n).style.left)+this.F;}}var M=this;setTimeout(function(){M.N()},this.B);};imagescroller.prototype.l=function(type){this.f=1;var M=this;if(type==0){M.N();}else{M.O();}};
	imagescroller.prototype.m=function(i){
		this.f=0; 
		clearTimeout(this.d);clearTimeout(timeOut);};
	imagescroller.prototype.J=function(i,e){
		var k=(navigator.userAgent.indexOf('MSIE')!=-1&&navigator.userAgent.indexOf('Windows')!=-1); 
   
   var count=url.length; 
   
   if(url.length<12){
	   for(var k=count;k<=12;k++){
		   url[k]=url[k%count];
		   }
	   } 
	window.location= url[i];
   
	};
 function slideShow(id){
		var L='/Service/PhotoAlbum/SlideShow/?id='.concat(id);
		var T='';
		T=T.concat('status=no,resizable=yes,scrollbars=no,toolbar=no,location=no,fullscreen=no,');
		T=T.concat('titlebar=no,height=500,width=800,');
		T=T.concat('top=').concat((screen.height-500)/2).concat(',');
		T=T.concat('left=').concat((screen.width-800)/2);
		 
		var P=open(L,'_blank',T);

   };
