/* 
 * jRotate Object * created by EMVI Develop * http://www.emvi.de/develop.html 	
 * jRotate needs jQuery & jScript	
 */
jRotate=function(elem,className,width,height,vars){if(!elem||!className||!width||!height)return;if(vars){var tmps=vars.split('&');for(var i in tmps){var tmp=tmps[i].split('=');if(tmp[0]&&tmp[1]){eval('var '+tmp[0]+'=\''+tmp[1]+'\'');}}};if(!style){var style;};if(!speed){var speed=30;}else{speed=parseInt(speed);if(speed<1||speed>12){speed=30;}else{speed*=5;}};if(!$(elem).attr('id')||$(elem).attr('id')==''){$(elem).attr('id',new Date().getTime());};this._init(elem,className,width,height,style,speed);};jRotate.prototype._init=function(elem,className,width,height,style,timer){$('img.'+className).css('display','none');this._pref=new Array;this._pref['elem']=elem;this._pref['id']=$(elem).attr('id');this._pref['width']=width;this._pref['height']=height;this._pref['pos']=0;this._pref['way']=1;this._pref['timer']=timer;this._pref['gui']=this._getGUI(style);this._pref['img']=this._getIMG(className);var _self=this;$(elem).click(function(){_self._pref['way']*=-1});$(elem).css('width',this._pref['width']).css('height',this._pref['height']).css('padding','0px').css('overflow','hidden').css('background-color',this._pref['gui']['background-color']).css('background-position','50% 50%').css('background-image','url('+this._pref['gui']['loading']+')').css('background-repeat','no-repeat');var img=new Image();img.onload=function(){_self._pref['limit']=img.width;_self._pref['limit']*=-1;$(_self._pref['elem']).css('background-position','0px 50%').css('background-image','url('+img.src+')').css('background-repeat','repeat-x');_self._move();};img.src=this._pref['img'][0];};jRotate.prototype._move=function(){if(this._pref['way']==-1){this._pref['pos']++;}else{this._pref['pos']--;}if(this._pref['pos']<this._pref['limit']){this._pref['pos']=0;}if(this._pref['pos']>0){this._pref['pos']=this._pref['limit'];};$(this._pref['elem']).css('background-position',this._pref['pos']+'px 50%');var _self=this;window.setTimeout(function(){_self._move();},_self._pref['timer']);};jRotate.prototype._getIMG=function(className){var _self=this;var img=new Array();$('.'+className).each(function(){img.push($(this).attr('src'))});return img;};jRotate.prototype._getGUI=function(style){var root='http://lib.emvi.de/jGui/';var gui=new Array();gui['black']=new Array();gui['black']['background-color']='black';gui['black']['loading']=root+'jLoading.black.gif';gui['black']['control']=root+'jControl.black.png';gui['white']=new Array();gui['white']['background-color']='white';gui['white']['loading']=root+'jLoading.white.gif';gui['white']['control']=root+'jControl.white.png';gui['blk-wht']=new Array();gui['blk-wht']['background-color']='black';gui['blk-wht']['loading']=root+'jLoading.black.gif';gui['blk-wht']['control']=root+'jControl.white.png';gui['wht-blk']=new Array();gui['wht-blk']['background-color']='white';gui['wht-blk']['loading']=root+'jLoading.white.gif';gui['wht-blk']['control']=root+'jControl.black.png';if($.inArray(style,gui)==-1){style='black';};return gui[style];};
