/*<![CDATA[*/
// Continious ScrollerII (14-December-2007)
// by: Vic Phillips http://www.vicsjavascripts.org.uk


// Application Notes
// The effect is initialised and controlled by event calls to function
// zxcScroller('h','tst2','start',1,100,200);
// where:
// parameter 0 = the mode, for vertical 'v', for horizontal 'h'.                     (string 'v' or 'h');
// parameter 1 = the unique id name of the scroll container.                         (string);
// parameter 2 = start or stop.                                                      (string 'start' or 'stop');
// parameter 3 = to scroll up/left = negative digit or down/right = positive digit.  (digit);
//               may also be used to control the scroll speed.
// parameter 4 = the scroll speed (milli seconds).                                   (digits);
// parameter 5 = the initial delay before scrolling (milli seconds).                 (digits);
//
// The first call will initialise the effect.
// Subsequent calls may be used control the effect by updating parameters 2, 3 and 4.
// If parameters 2 or 3 are not specified the parameter will be toggled.
// Examples
//<input type="button" name="" value="Toggle Direction" onclick="zxcScroller('h','tst2','start');"/>
//<input type="button" name="" value="Toggle Stop/Start" onclick="zxcScroller('h','tst2');"/>

// Functional Code size = 2.4k

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function zxcScroller(zxcmde,zxcid,zxcrun,zxcud,zxcspd,zxcsrt){
 var zxcp=document.getElementById(zxcid);
 if (!zxcp[zxcmde+'scroll']) return zxcp[zxcmde+'scroll']= new zxcScrollerOOP(zxcmde,zxcp,zxcrun,zxcud,zxcspd,zxcsrt);
 var zxcoop=zxcp[zxcmde+'scroll']
 clearTimeout(zxcp.to);
 zxcoop.spd=zxcspd||zxcoop.spd;
 zxcoop.ud=zxcud||-zxcoop.ud; 
 zxcp[zxcmde+'run']=(zxcrun=='stop'||zxcrun=='start')?zxcrun:(zxcp[zxcmde+'run']=='stop')?'start':'stop';
    if (zxcp[zxcmde+'run']=='start')
    {           
        zxcoop.scroll();
    } 
}

function zxcScrollerOOP(zxcmde,zxcp,zxcrun,zxcud,zxcspd,zxcsrt)
{ 
 this.p=zxcp;
 var zxcc=this.p.getElementsByTagName('DIV')[0]
 this.vh=(StrCharAt(zxcmde,0,'L')=='v');
 this.mde=zxcmde;
 this.ary=[]; 
 this.ary[0]=[zxcc,0];
 var zxcmax=(((this.vh)?this.ary[0][0].offsetHeight:this.ary[0][0].offsetWidth))+((this.vh)?this.p.offsetHeight:this.p.offsetWidth);
 this.wh=(StrCharAt(this.mde,0,'L')=='v')?this.ary[0][0].offsetHeight:this.ary[0][0].offsetWidth;
 var zxcpos=0;  
 while (zxcpos<zxcmax)
 {  
  var zxc1=this.ary.length;     
  this.ary[zxc1]=[zxcES(this.ary[0][0].cloneNode(true),{},this.p),zxcpos+=this.wh];
  //zxcES(this.ary[zxc1][0],{position:'absolute',left:((this.vh)?0:this.ary[zxc1][1])+'px',top:((this.vh)?this.ary[zxc1][1]:0)+'px'});
 } 
 this.ud=zxcud||-1;
 this.spd=zxcspd||100;
 this.p.to=null;
 this.data=[zxcpos,-this.wh];
 this.p[this.mde+'run']=(zxcrun=='stop'||zxcrun=='start')?zxcrun:'start';
 if (this.p[this.mde+'run']) this.p.to=setTimeout(function(zxcoop){return function(){zxcoop.scroll();}}(this),zxcsrt||500);
}

zxcScrollerOOP.prototype.scroll=function(){
 if (this.p[this.mde+'run']=='start'){
  for (var zxc1=0;zxc1<this.ary.length;zxc1++){   
   this.ary[zxc1][1] +=this.ud;      
   zxcES(this.ary[zxc1][0],{position:'absolute',left:((this.vh)?0:this.ary[zxc1][1])+'px',top:((this.vh)?this.ary[zxc1][1]:0)+'px'});   
   if ((this.ud<0&&this.ary[zxc1][1]<=this.data[1])||(this.ud>0&&this.ary[zxc1][1]>this.data[0])) this.ary[zxc1][1]=this.data[(this.ud<0)?0:1];
  }
 }
 this.p.to=setTimeout(function(zxcoop){return function(){zxcoop.scroll();}}(this),this.spd);
}

function zxcES(zxcele,zxcstyle,zxcp,zxctxt,zxcClass)
{     

 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle)
 {      
    zxcele.style[key]=zxcstyle[key];     
 }  
  if(zxcClass!=undefined)
  {
        zxcele.className="Scraddcartbox";
 }
 if (zxcp){zxcp.appendChild(zxcele);} 
 if (zxctxt){zxcele.appendChild(document.createTextNode(zxctxt));} 
 return zxcele;
}


/*<![CDATA[*/
// Basic Element Animator (12-January-2007) DRAFT
// by Vic Phillips http://www.vicsjavascripts.org.uk

// To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.

// **** Application Notes

// **** The HTML Code
//
// when moving an element the inline or class rule style position of the element should be assigned as
// 'position:relative;' or 'position:absolute;'
//
// The element would normally be assigned a unique ID name.
//

// **** Executing the Effect(Script)
//
// The effect is executed by an event call to function 'zxcBAnimator('left','tst1',20,260,2000);'
// where:
// parameter 0 = the mode(see Note 1).                                                                     (string)
// parameter 1 = the unique ID name or element object.                                                     (string or element object)
// parameter 2 = the start position of the effect.                                                         (digits, for opacity minimum 0, maximum 100)
// parameter 3 = the finish position of the effect.                                                        (digits, for opacity minimum 0, maximum 100)
// parameter 4 = (optional) period of time between the start and finish of the effect in milliseconds.     (digits or defaults to 2000 milliSeconds)
//
//  Note 1:  The default units(excepting opacity) are 'px'.
//  Note 2:  Examples modes: 'left', 'top', 'width', 'height', 'opacity.
//           For hyphenated modes, the first character after the hyphen must be upper case, all others lower case.
//  Note 3:  To 'toggle' the effect include '#' in parameter 0.
//           The first call will set the toggle parameters.
//           Subsequent calls with '#' in parameter 0 and the same start and finish parameters will 'toggle' the effect.
//  Note 4:  The function may be re-executed with a different set of parameters (start/finish time or period)
//           whenever required, say from an onclick/mouseover/out event.
//           The period parameter will be retained unless re-specified.
//
// **** Advanced Applications
//
//  It may be required to access the current value of the effect.
//  The element effect is accessible from the element property
//  element effect = elementobject[mode.replace(/[-#]/g,'')+'oop'];
//  where mode is parameter 0 of the initial call.
//  An array storing the current, start and finish values of the element effect may be accessed
//  from the element effect.data as fields 0, 1 and 2 respectively
//

// **** General
//
// All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts.
// These characters may be changed to characters of choice using global find and replace.
//
// The Functional Code (about 2K) is best as an External JavaScript.
//
// Tested with IE7 and Mozilla FireFox on a PC.
//



// **** Functional Code - NO NEED to Change


function zxcBAnimator(zxcmde,zxcobj,zxcsrt,zxcfin,zxctime){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj); }
 if (!zxcobj||(!zxcsrt&&!zxcfin)) return;
 var zxcoop=zxcobj[StrReplace(zxcmde,/[-#]/g,'')+'oop'];
 if (zxcoop){
  clearTimeout(zxcoop.to);
  if (zxcoop.srtfin[0]==zxcsrt&&zxcoop.srtfin[1]==zxcfin&&zxcmde.match('#')) zxcoop.update([zxcoop.data[0],(zxcoop.srtfin[0]==zxcoop.data[2])?zxcfin:zxcsrt],zxctime);
  else zxcoop.update([zxcsrt,zxcfin],zxctime);
 }
 else zxcobj[StrReplace(zxcmde,/[-#]/g,'')+'oop']=new zxcBAnimatorOOP(zxcmde,zxcobj,zxcsrt,zxcfin,zxctime);
}

function zxcBAnimatorOOP(zxcmde,zxcobj,zxcsrt,zxcfin,zxctime){
 this.srtfin=[zxcsrt,zxcfin];
 this.to=null;
 this.obj=zxcobj;
 this.mde=StrReplace(zxcmde,/[-#]/g,'');
 this.update([zxcsrt,zxcfin],zxctime);
}

zxcBAnimatorOOP.prototype.update=function(zxcsrtfin,zxctime){
 this.time=zxctime||this.time||2000;
 if (zxcsrtfin[0]==zxcsrtfin[1]) return;
 this.data=[zxcsrtfin[0],zxcsrtfin[0],zxcsrtfin[1]];
 this.srttime=new Date().getTime();
 this.cng();
}

zxcBAnimatorOOP.prototype.cng=function(){
 var zxcms=new Date().getTime()-this.srttime;
 this.data[0]=(this.data[2]-this.data[1])/this.time*zxcms+this.data[1];
 if (this.mde!='opacity') this.obj.style[this.mde]=this.data[0]+'px';
 else  this.opacity(this.data[0]);
 if (zxcms<this.time) this.to=setTimeout(function(zxcoop){return function(){zxcoop.cng();}}(this), 10);
 else {
  if (this.mde!='opacity') this.obj.style[this.mde]=this.data[2]+'px';
  else  this.opacity(this.data[2]);
 }
}

zxcBAnimatorOOP.prototype.opacity=function(zxcopc){
 if (zxcopc<0||zxcopc>100){ return; }
 //this.obj.style.filter='alpha(opacity=100%)'; //+zxcopc+')';
 //this.obj.style.opacity=this.obj.style.MozOpacity=this.obj.style.KhtmlOpacity=zxcopc/100-.001;
}



var ImgPath='http://www.artflute.com';
var ImgAry=[];
var ImgAry1=[];

// parameter 0 = the id of the parent Node.              (string)
// parameter 1 = the image array.                        (array)
// parameter 2 = the width * height of the image parent. (string)
// parameter 3 = the width * height of the image.        (string)
// parameter 4 = the speed on the resize effect.         (string)

function zxcScrollContent(zxcid,zxcary,zxcdivsz,zxcimgsz,zxcopac,zxcspd,strSpan)
{       
 zxcdivsz=zxcdivsz||'180*150';
 zxcimgsz=zxcimgsz||'150*150';
 zxcopac=zxcopac||'100*50';
 zxcspd=zxcspd||200;
 var zxcp=document.getElementById(zxcid);
 zxcdivsz=StrSplit(zxcdivsz,'*');
 zxcimgsz=StrSplit(zxcimgsz,'*');
 zxcopac=StrSplit(zxcopac,'*');
 
 var zxcc=zxcES('DIV',{position:'relative'},zxcp);  
 for (var zxc0=0;zxc0<zxcary.length;zxc0++)
 {  
    var zxcdiv=zxcES('DIV',{position:'absolute',left:zxcdivsz[0]*zxc0+'px',top:'0px',width:zxcdivsz[0]+'px',height:(1 * zxcdivsz[1] + 50) +'px'},zxcc,"","1");
    
    if (zxcary[zxc0][1]) zxcdiv.title=zxcary[zxc0][1];  
    var zxca=null;
    if (zxcary[zxc0][2]&&zxcary[zxc0][2]!='')
    {        
        zxca=zxcES('A',{},zxcdiv);
        zxca.href=zxcary[zxc0][2];  
    }
    var zxcimg=zxcES('IMG',{position:'absolute',left:(zxcdivsz[0]-zxcimgsz[0])/2+'px',top:(zxcdivsz[1]-zxcimgsz[1])/2+'px',width:zxcimgsz[0]+'px',height:zxcimgsz[1]+'px',borderWidth:'0px'},(zxcary[zxc0][2])?zxca:zxcdiv);    
    //zxcimg.src=zxcary[zxc0][0];   
	var srctemp=zxcary[zxc0][0];
    if(srctemp.indexOf("ImageThumbnailer.ashx")<0)
    {   
        srctemp=srctemp.replace(ImgPath,"");
        zxcimg.src= "ImageThumbnailer.ashx?sizeType=OriSize&img=" + srctemp;
    }
    else
    {
        zxcimg.src= srctemp;
    }
    
    var zxcSpan=zxcES('span',{position:'absolute',left:(zxcdivsz[0]-zxcimgsz[0])/2+'px',top:'85px',color:'#FFFFFF',textalign:'center'},zxcdiv); 
    zxcSpan.innerHTML=zxcary[zxc0][4]; 
  
 }  
//alert(zxcc.innerHTML);
 zxcES(zxcc,{width:zxcdivsz[0]*zxcary.length+'px',height:zxcdivsz[1]+'px'});
 zxcScroller('h',zxcid,'start',-1,10,1200); 
 
 var zxcimgs=zxcp.getElementsByTagName('IMG');
 var zxccnt=0;   
 for (var zxc1=0;zxc1<zxcimgs.length;zxc1++)
 { 
  zxcimgs[zxc1].data=[(zxcdivsz[0]-zxcimgsz[0])/2,(zxcdivsz[1]-zxcimgsz[1])/2,zxcimgsz[0]*1,zxcdivsz[0]*1,zxcimgsz[1]*1,zxcdivsz[1]*1,zxcopac[0]*1,zxcopac[1]*1];
  //zxcimgs[zxc1].onmouseover=function(){ zxcReSize(this,zxcspd); }
  //zxcimgs[zxc1].onmouseout=function(){ zxcReSize(this,zxcspd); }  
  if (window[zxcary[zxccnt][3]])
  {   
   zxcimgs[zxc1].nu=zxccnt;
   zxcimgs[zxc1].fun=zxcary[zxccnt][3];
   zxcimgs[zxc1].onclick=function(){ window[this.fun](this.nu); }
  }
  zxccnt=++zxccnt%zxcary.length  
  //zxcBAnimator('opacity#',zxcimgs[zxc1],zxcimgs[zxc1].data[6],zxcimgs[zxc1].data[7],10);
 }
}

function zxcReSize(zxcobj,zxcspd){
 zxcBAnimator('width#',zxcobj,zxcobj.data[2],zxcobj.data[3],zxcspd);
 zxcBAnimator('left#',zxcobj,zxcobj.data[0],0,zxcspd);
 zxcBAnimator('height#',zxcobj,zxcobj.data[4],zxcobj.data[5],zxcspd);
 zxcBAnimator('top#',zxcobj,zxcobj.data[1],0,zxcspd);
 zxcBAnimator('opacity#',zxcobj,zxcobj.data[6],zxcobj.data[7],zxcspd);
}

function MyFunction(nu){
 document.Show.Show0.value=ImgAry[nu]; 
 return false;
}

