/*
* jslous.js ver.2.0 extend mag.js
* 
* Revision : 82
*
* writen by Magnum
*
* No dependency on external libraries
*
* Requirements:
*  on Server :
*   Apache 1.1.3 or higher,IIS 6.0 or higher.
*   PHP 4.3.9 or higher.
*   DB : MySQL 4.1.20 or higher,PostgreSQL 7.2 or higher.
*   GD : GD 2.0.28 or higher.
*  on Client :
*   Internet Explorer 6 or higher.
*   Safari 3 or higher.
*   FireFox 3 or higher.
*
* $Date: 2009-04-20$
*/
/*@cc_on 
var doc = document;
eval('var document = doc');
@*/
(function(){
 var window = this;
 var _jslous = window.jslous;
 var _$ = window.$;
 /* constructor */
 var jslous = window.jslous = window.$ = function(selector,current){
  return new jslous.func.initirizer(selector,current);
 };
 
 jslous.func = jslous.prototype = {
  initirizer : function(selector,current){
   selector = selector || document;
   if(selector.nodeType){
    this[0] = selector;
    this.length = 1;
    return this;
   }else if(typeof selector == "string"){
    current = current || document;
    return jslous().query(selector,current);
   }else if(jslous.is_func(selector)){
    return jslous(document).ready(selector);
   }else{
    return this.obj2array(jslous.initArray(selector));
   }
  },
  stacks : function(elm,selector){
   var result = jslous(elm);
   result.prv = this;
   if(selector){ result.selector = selector; }
   return result;
  },
  item : function(n){ return n === undefined ? jslous.initArray(this) : this[n]; },
  each : function(callback,args){ return jslous.each(this,callback,args); },
  map : function(callback){
   return this.stacks(jslous.map(this,function(elm,i){
	return callback.call(elm,i,elm);
   }));
  },
  obj2array : function(elm){
   this.length = 0;
   Array.prototype.push.apply(this,elm);
   return this;
  },
  query : function(selector,current){ return this.stacks(jslous.unique(this.obj2array(jslous.query(selector,current))),selector); },
  push : function(selector){ return this.stacks(jslous.unique(jslous.merge(this.item(),typeof selector === "string" ? jslous(selector) : jslous.initArray(selector)))); },
  filter : function(selector){ return this.stacks(jslous.filter(selector,this.prv),selector); },
  ready : function(selector){
   jslous.ready(selector);
   return this.stacks([],'');
  },
  req : function(url,method,$key,func,res){
   jslous.ajax(url,method,$key,func,res);
   return this.stacks(this,this.selector);
  },
  motion : function(obj){
   jslous.motion(this,obj);
   return this.stacks(this,this.selector);
  },
  sphere : function(obj){
   jslous.sphere(this,obj);
   return this.stacks(this,this.selector);
  },
  gloss : function(obj){
   jslous.gloss(this,obj);
   return this.stacks(this,this.selector);
  },
  verticalslider : function(obj){
   jslous.verticalslider(this,obj);
   return this.stacks(this,this.selector);
  },
  horizontalslider : function(obj){
   jslous.horizontalslider(this,obj);
   return this.stacks(this,this.selector);
  },
  camelize : function(str){ return jslous.camelize(str); },
  deCamelize : function(str){ return jslous.deCamelize(str); }
 }
 
 jslous.func.initirizer.prototype = jslous.func;
 jslous.extend = jslous.func.extend = function(){
  var target = arguments[0] || {},i = 1,length = arguments.length,deep = false,options;
  if(typeof target === 'boolean'){
   deep = target;
   target = arguments[1] || {};
   i = 2;
  }
  if(typeof target !== "object" && !jslous.is_func(target)){ target = {}; }
  if(length == i){ target = this; --i; }
  for(;i < length;i++){
   if((options = arguments[i]) != null){
	for(var name in options){
	 var src = target[name],copy = options[name];
	 if(target === copy){ continue; }
	 if(deep && copy && typeof copy === "object" && !copy.nodeType ){
	  target[name] = jslous.extend(deep,src || (copy.length != null ? []:{}),copy);
     }else if(copy !== undefined){
	  target[name] = copy;
	 }
	}
   }
  }
  return target;
 };

 var toString = Object.prototype.toString;
 /* Core */
 jslous.extend({
  is_num : function(obj){ return toString.call(obj) === '[object Number]'; },
  is_str : function(obj){ return toString.call(obj) === '[object String]'; },
  is_array : function(obj){ return toString.call(obj) === '[object Array]'; },
  is_func : function(obj){ return toString.call(obj) === '[object Function]'; },
  is_obj : function(obj){ return toString.call(obj) === '[object Object]'; },
  is_xml : function(elm){ return elem.nodeType === 9 && elm.documentElement.nodeName !== "HTML" || !!elm.ownerDocument && jslous.is_xml(elm.ownerDocument); },
  query : function(selector,current){ return htmlQuery(selector,current); },
  filter: function(selector,current){ return htmlQuery.filter(selector,current); },
  initArray : function(array){
   var result = [];
   if(array != null){
	var i = array.length;
	if(i == null || typeof array === "string" || jslous.is_func(array) || array.setInterval){
	 result[0] = array;
	}else{
	 while(i){ result[--i] = array[i]; }
	}
   }
   return result;
  },
  each : function(obj,callback,args){
   var name, i = 0,length = obj.length;
   if(args){
	if(length === undefined){
	 for(name in obj){ if(callback.apply(obj[name],args) === false){ break; } }
	}else{
	 for(; i < length;){ if(callback.apply(obj[i++],args) === false){ break; } }
    }
   }else{
	if(length === undefined){
	 for(name in obj){ if(callback.call(obj[name],name,obj[name]) === false ){ break; } }
	}else{
	 for(var value = obj[0];i < length && callback.call(value,i,value ) !== false; value = obj[++i]){}
	}
   }
   return obj;
  },
  map : function(elms,callback){
   var ret = [];
   for(var i = 0,length = elms.length;i < length;i++){
	var value = callback(elms[i],i);
    if(value != null){ ret[ret.length] = value; }
   }
   return ret.concat.apply([],ret);
  },
  merge : function(first,second){
   var i = 0,elm,pos = first.length;
   while((elm = second[i++]) != null){ first[pos++] = elm; }
   return first;
  },
  unique : function(array){
   var ret = [],done = {};
   try{
    for(var i = 0,length = array.length;i < length;i++){
     var id = jslous.data(array[i]);
     if(!done[id]){
	  done[id] = true;
	  ret.push(array[i]);
	 }
    }
   }catch(e){ ret = array; }
   return ret;
  },
  objrandom : function(obj){
   var objarray = [];
   for(var f in obj){ objarray.push(f); }
   return objarray[Math.floor(Math.random()*objarray.length)];
  },
  objclone : function(obj){
   var ret = {};
   for(var p in obj){ ret[p] = obj[p]; }
   return ret;
  },
  camelize : function(str){ return str.replace(/-([a-z])/g,function($0,$1){ return $1.toUpperCase(); }); },
  deCamelize : function(str){ return str.replace(/[A-Z]/g,function($0){ return '-'+$0.toLowerCase(); }); },
  motion : function(elms,obj){
   jslous.each(elms,function(opt){
    var trg = this;
    jslous.func.motion.Listener(trg.style,jslous.objclone(opt));
   },[obj]);
   return this;
  },
  sphere : function(elms,obj){
   jslous.each(elms,function(opt){
    var trg = this;
    jslous.canvas.globe.Listener(trg,jslous.objclone(opt));
   },[obj]);
   return this;
  },
  gloss : function(elms,obj){
   jslous.each(elms,function(opt){
    var trg = this;
    jslous.canvas.gloss.Listener(trg,jslous.objclone(opt));
   },[obj]);
   return this;
  },
  verticalslider : function(elms,obj){
   jslous.each(elms,function(opt){
    var trg = this;
    jslous.func.slider.vertical(trg,jslous.objclone(opt));
   },[obj]);
  },
  horizontalslider : function(elms,obj){
   jslous.each(elms,function(opt){
    var trg = this;
    jslous.func.slider.horizontal(trg,jslous.objclone(opt));
   },[obj]);
  },
  ajax : function(url,method,$key,func,res){
   var req,response;
   try{
    req = new ActiveXObject("Msxml2.XMLHTTP");
   }catch(e){
    try{
     req = new ActiveXObject("Microsoft.XMLHTTP");
    }catch(e){
     req = false;
    }
   }
   if(!req && typeof XMLHttpRequest != "undefined"){ req = new XMLHttpRequest(); }
   if(req){
    req.onreadystatechange = function(){
     if(req.readyState == 4 && req.status == 200){
      response = (res == 'xml' ? req.responseXML:req.responseText);
      func(response);
     }
    }
    req.open(method,url);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
    req.send($key);
   }
  }
 });
 
 var uid = function(){ return +new Date(); },nid = 0,wData = {};
 
 /* data cache */
 jslous.extend({
  cache : {},
  save : function(elm,name,data){
   elm = elm == window ? wData:elm;
   var id = elm[uid];
   if(!id){ id = elm[uid] = ++nid; }
   if(name && !jslous.cache[id]){ jslous.cache[id] = {}; }
   if(data !== undefined){ jslous.cache[id][name] = data; }
   return name ? jslous.cache[id][name]:id;
  }
 });
 
 /* Browser Flags */
 jslous.Agents = {
  ie : (navigator.appName.toLowerCase().indexOf('internet explorer')+1 ? true:false),
  firefox : (navigator.userAgent.toLowerCase().indexOf('firefox')+1 ? true:false),
  webkit : (navigator.userAgent.indexOf('AppleWebKit/') > -1 ? true:false),
  opera : (window.opera ? true:false)
 };
 
 /* CSSController */
 jslous.css = {
  setstyle : function(elm,prop,val){ if(elm){ elm.style[jslous.camelize(prop)] = val; } },
  setstyles : function(elm,obj){ if(elm && jslous.is_obj(obj)){ for(var prop in obj){ try{ elm.style[jslous.camelize(prop)] = obj[prop]; }catch(e){} } } },
  getInline : function(elm){ return (jslous.Agents.ie ? elm.style.cssText+';':elm.getAttribute('style')); },
  setInline : function(elm,style){ jslous.Agents.ie ? elm.style.cssText = jslous.css.getInline(elm)+style+';':elm.setAttribute('style',jslous.css.getInline(elm)+style); },
  opacity : function(elm,value){ jslous.Agents.ie ? elm.style.filter = 'alpha(opacity='+(value)+')':jslous.Agents.webkit ? elm.style.opacity = value/100:elm.style.MozOpacity = value/100; },
  current : function(elm,property,pseudo){ return (elm.currentStyle ? (property.indexOf('-') != -1 ? elm.currentStyle[jslous.camelize(property)]:elm.currentStyle[property]):getComputedStyle ? (property.indexOf('-') == -1 ? document.defaultView.getComputedStyle(elm,pseudo).getPropertyValue(jslous.deCamelize(property)):document.defaultView.getComputedStyle(elm,pseudo).getPropertyValue(property)):false); },
  selector : function(selector){
   var css = document.styleSheets;
   for(var i = 0;i < css.length;i++){
    var rules = (css.item(i).cssRules ? css.item(i).cssRules:css.item(i).rules ? css.item(i).rules:false);
    for(var k = 0;k < rules.length;k++){
     var rule = rules.item(k);
     if(!rule.selectorText){ continue; }
     if(rule.selectorText.toLowerCase() == selector.toLowerCase()){ return rule.style; }
    }
   }
  }
 }
 
 /* sizeGetter */
 jslous.size = {
  screenWidth : screen.availWidth,
  screenHeight : screen.availHeight,
  clientWidth : function(){ return (jslous.Agents.ie ? document.documentElement.clientWidth:window.innerWidth); },
  clientHeight : function(){ return (jslous.Agents.ie ? document.documentElement.clientHeight:window.innerHeight); },
  documentWidth : function(){ return Math.max(document.documentElement.scrollWidth,document.body.scrollWidth); },
  documentHeight : function(){ return Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); },
  scrollLeft : function(){ return Math.max(document.body.scrollLeft,document.documentElement.scrollLeft); },
  scrollTop : function(){ return Math.max(document.body.scrollTop,document.documentElement.scrollTop); }
 }
 
 /* NodeController */
 jslous.node = {
  children : function(node){
   var elm = new Array(),i,inner,str;
   if(!node || !node.hasChildNodes()){ return elm; }
   var children = node.childNodes;
   for(i = 0;i < children.length;i++){
    inner = children.item(i);
    if(inner.nodeType == 3){
     str = inner.nodeValue;
     if(!str.match('/[^\s\t\n\r]/')){ continue; }
    }
    elm.push(inner);
   }
   return elm;
  },
  prv : function(node){
   if(!node){ return null; }
   var obj,pvs,str;
   obj = node;
   while(pvs = obj.previousSibling){
    if(pvs.nodeType == 3){
     str = pvs.nodeValue;
     if(!str.match('/[^\s\t\n\r]/')){
      obj = pvs;
      continue;
     }
    }
    return pvs;
   }
   return null;
  },
  next : function(node){
   if(!node){ return null; }
   var obj,nxt,str;
   obj = node;
   while(nxt = obj.nextSibling){
    if(nxt.nodeType == 3){
     str = nxt.nodeValue;
     if(!str.match('/[^\s\t\n\r]/')){
      obj = nxt;
      continue;
     }
    }
    return nxt;
   }
   return null;
  },
  gettxt : function(node){
   var i,obj,str = '';
   if(!node){ return str; }
   if(typeof node.textContent != 'undefined'){
    str = node.textContent;
   }else if(typeof node.innerText != 'undefined'){
    str = node.innerText;
   }else if(node.hasChildNodes()){
    for(i = node.childNodes.length;i--;){
     obj = node.childNodes.item(i);
     str = obj.nodeType == 3 ? obj.nodeValue+str:$.getInnerTxt(obj)+str;    
    }
   }
   return str;
  },
  insertFirst : function(elm,parent){ parent && parent != null ? parent.insertBefore(elm,parent.firstChild):document.body.insertBefore(elm,document.body.firstChild); },
  removeChilds : function(node){ while(node.hasChildNodes()){ node.removeChild(node.lastChild); } },
  replace : function(newelm,oldelm){ if(oldelm && oldelm != null){ oldelm.parentNode.replaceChild(newelm,oldelm); } },
  change : function(a,b){
   var clonea = a.cloneNode(true);
   a.parentNode.insertBefore(clonea,a);
   var cloneb = b.cloneNode(true);
   b.parentNode.insertBefore(cloneb,b);
   jslous.node.replace(b,clonea);
   jslous.node.replace(a,cloneb);
  }
 }
 
 /* StringController */
 jslous.String = {
  toArray : function(str,flg){
   if(!str){ return false; }
   var result = new Array();
   while(str.length > 0){
    if(str.substr(0,4).toLowerCase() == '<br>'){
     result.push((flg ? document.createElement('br'):'<br />'));
     str = str.slice(4);
    }else if(str.substr(0,6).toLowerCase() == '<br />'){
     result.push((flg ? document.createElement('br'):'<br />'));
     str = str.slice(6);
    }else{
     if(flg){
      var span = document.createElement('span');
      span.appendChild(document.createTextNode(str.slice(0,1)));
      result.push(span);
     }else{
      result.push(str.slice(0,1));
     }
     str = str.slice(1);
    }
   }
   return result;
  }
 }
 
 /* MathController */
 jslous.Math = {
  random : function(min,max,num){
   var min = min || 0,max = max || 10,num = num || 1,tmp = new Array(),result = new Array();
   for(var i = min;i <= max;i++){ tmp.push(i); }
   while(num){
    tmp.sort(function(){ return Math.random() > 0.5 ? 1:-1; });
    result.push(tmp.slice(0,1));
    num--;
   }
   return (num != 1 ? result:result[0]);
  }
 }
 
 /* EventController */
 jslous.Event = {
  getevt : function(evt){ return (!evt ? window.event:evt); },
  target : function(evt){ return (jslous.Event.getevt(evt) && jslous.Event.getevt(evt).target ? (jslous.Event.getevt(evt).target.nodeType == 3 ? jslous.Event.getevt(evt).target.parentNode:jslous.Event.getevt(evt).target):(jslous.Event.getevt(evt) && jslous.Event.getevt(evt).srcElement ? jslous.Event.getevt(evt).srcElement:null)); },
  Listener : function(elm,type,func){ return (!elm ? false:(elm.addEventListener ? elm.addEventListener(type,func,false):elm.attachEvent ? elm.attachEvent('on'+type,func):false)); },
  removeListener : function(elm,type,func){ return (!elm ? false:(elm.removeEventListener ? elm.removeEventListener(type,func,false):elm.detachEvent ? elm.detachEvent('on'+type,func):false)); },
  cancelBubble : function(evt){ evt && evt.stopPropagation ? evt.stopPropagation():window.event ? window.event.cancelBubble = true:false; },
  preventDefault : function(evt){
   if(evt && evt.preventDefault){
    evt.preventDefault();
    evt.currentTarget['on'+evt.type] = function(){
     return false;
    };
   }else if(window.event){ window.event.returnValue = false; }
  },
  fireEvt : function(elm,type){
   if(elm.dispatchEvent){
    var evt = document.createEvent('MouseEvents');
    evt.initEvent(type,true,true);
    elm.dispatchEvent(evt);
   }else if(window.event){
    var evt = document.createEventObject();
    evt.button = 1;
    elm.fireEvent('on'+type,evt);
   }
  },
  clientX : function(evt){ return (jslous.Agents.opera ? jslous.Event.getevt(evt).clientX:jslous.Agents.ie ? (jslous.size.scrollLeft()+jslous.Event.getevt(evt).clientX):jslous.Agents.webkit ? jslous.Event.getevt(evt).pageX:jslous.Event.getevt(evt).pageX); },
  clientY : function(evt){ return (jslous.Agents.opera ? jslous.Event.getevt(evt).clientY:jslous.Agents.ie ? (jslous.size.scrollTop()+jslous.Event.getevt(evt).clientY):jslous.Agents.webkit ? jslous.Event.getevt(evt).pageY:jslous.Event.getevt(evt).pageY); },
  offsetX : function(evt){ return (jslous.Agents.ie || jslous.Agents.webkit ? jslous.Event.getevt(evt).offsetX:jslous.Event.getevt(evt).layerX); },
  offsetY : function(evt){ return (jslous.Agents.ie || jslous.Agents.webkit ? jslous.Event.getevt(evt).offsetY:jslous.Event.getevt(evt).layerY); },
  char : function(evt){ return ((jslous.Event.getevt(evt).charCode) ? Number(jslous.Event.getevt(evt).charCode):((jslous.Event.getevt(evt).which) ? Number(jslous.Event.getevt(evt).which):Number(jslous.Event.getevt(evt).keyCode))); }
 };
 
 /* Handlers */
 jslous.func.extend({
  click : function(func){
   jslous.each(this,function(){ jslous.Event.Listener(this,'click',func); });
   return this.stacks(this,this.selector);
  },
  down : function(func){
   jslous.each(this,function(){ jslous.Event.Listener(this,'mousedown',func); });
   return this.stacks(this,this.selector);
  },
  hover : function(over,out){
   jslous.each(this,function(){
    jslous.Event.Listener(this,'mouseover',over);
    jslous.Event.Listener(this,'mouseout',out);
   });
   return this.stacks(this,this.selector);
  },
  activate : function(focus,blur){
   jslous.each(this,function(){
    jslous.Event.Listener(this,'focus',focus);
    jslous.Event.Listener(this,'blur',blur);
   });
   return this.stacks(this,this.selector);
  },
  toggle : function(on,off){
   jslous.each(this,function(){
    var elm = this;
    elm.toggleflg = false;
    jslous.Event.Listener(elm,'mousedown',function(evt){
     var trg = jslous.Event.target(evt);
     if(trg.toggleflg == false){
      trg.toggleflg = true;
      if(jslous.is_func(on)){ on.apply(this,[elm]); }
     }else if(trg.toggleflg == true){
      trg.toggleflg = false;
      if(jslous.is_func(off)){ off.apply(this,[elm]); }
     }
     jslous.Event.preventDefault(evt);
    });
   });
   return this.stacks(this,this.selector);
  },
  keypress : function(func){
   jslous.each(this,function(){ jslous.Event.Listener(this,'keypress',func); });
   return this.stacks(this,this.selector);
  },
  debug : function(){
   for(var i in this){
    alert(i);
   }
  }
 });
 
 /* KeyBoardHandles */
 jslous.input = {
  chkret : function(evt){
   var char = jslous.Event.char(evt);
   return ((char == 13 || char == 3) ? true:false);
  }
 }
 
 /* elementPosition */
 jslous.elmPos = {
  left : function(elm){
   if(jslous.Agents.ie){ return elm.getBoundingClientRect().left-2; }
   var pos = 0;
   pos = jslous.Agents.webkit ? pos-elm.clientLeft:pos;
   while(elm){
    pos += jslous.Agents.webkit ? elm.offsetLeft+elm.clientLeft:elm.offsetLeft;
    elm = elm.offsetParent;
   }
   return (pos-jslous.size.scrollLeft());
  },
  top : function(elm){ // elementTopPosition
   if(jslous.Agents.ie){ return elm.getBoundingClientRect().top-2; }
   var pos = 0;
   pos = jslous.Agents.webkit ? pos-elm.clientTop:pos;
   while(elm){
    pos += jslous.Agents.webkit ? elm.offsetTop+elm.clientTop:elm.offsetTop;
    elm = elm.offsetParent;
   }
   return (pos-jslous.size.scrollTop());
  },
  center : function(elm){ return parseInt((jslous.size.scrollLeft() > 0 ? (jslous.size.clientWidth()-elm.offsetWidth)/2+jslous.size.scrollLeft():(jslous.size.clientWidth()-elm.offsetWidth)/2)); },
  middle : function(elm){ return parseInt((jslous.size.scrollTop() > 0 ? ((jslous.size.clientHeight()-elm.offsetHeight)/2)+jslous.size.scrollTop():((jslous.size.clientHeight()-elm.offsetHeight)/2)+50)); },
  area : function(elm){ return (elm ? { left : jslous.elmPos.left(elm),top : jslous.elmPos.top(elm),right : jslous.elmPos.left(elm)+elm.offsetWidth-1,bottom : jslous.elmPos.top(elm)+elm.offsetHeight-1 }:false); },
  bounds : function(evt,elm){
   var bounds = jslous.elmPos.getarea(elm);
   return (jslous.Event.clientX(evt) > bounds.left && jslous.Event.clientX(evt)+bounds.left < bounds.right && jslous.Event.clientY(evt) > bounds.top && jslous.Event.clientY(evt)+bounds.top < bounds.bottom ? true:false);
  }
 }
 
 /* colorScheme */
 jslous.color = {
  codeConvert : function(code,inbase,outbase){
   code = (code+'').toUpperCase();
   var chars = '0123456789ABCDEF',dec = 0;
   for(var no = 0;no <= code.length;no++){ dec += (chars.indexOf(code.charAt(no)))*(Math.pow(inbase,(code.length-no-1))); }
   code = '';
   var magnitude = Math.floor((Math.log(dec))/(Math.log(outbase)));
   for(var no = magnitude;no >= 0;no--){
    var amount = Math.floor(dec/Math.pow(outbase,no));
    code = code+chars.charAt(amount); 
    dec -= amount*(Math.pow(outbase,no));
   }
   if(code.length == 0){ code = 0; }
   return code;
  },
  num2hex : function(num){
   hex = jslous.color.codeConvert(num,10,16)+'';
   while(hex.length < 2){ hex = '0'+hex; }
   return hex;
  },
  hex2num : function(hex){
   hex = hex.replace('#','');
   return { r : parseInt(jslous.color.codeConvert(hex.substr(0,2),16,10)), g : parseInt(jslous.color.codeConvert(hex.substr(2,2),16,10)), b : parseInt(jslous.color.codeConvert(hex.substr(4,2),16,10)) };
  },
  hex2rgb : function(hex,f){
   f = f || 1;
   function h2d(bright){ return(Math.max(0,Math.min(parseInt(bright,16),255))); }
   function d2h(bright){
    bright = Math.round(Math.min(Math.max(0,bright),255)); 
    return('0123456789ABCDEF'.charAt((bright-bright%16)/16)+'0123456789ABCDEF'.charAt(bright%16));
   }
   var cr = h2d(hex.substr(1,2)),cg = h2d(hex.substr(3,2)),cb = h2d(hex.substr(5,2));
   return (jslous.Agents.ie ? '#'+d2h(cr*f)+''+d2h(cg*f)+''+d2h(cb*f):Math.floor(cr*f)+','+Math.floor(cg*f)+','+Math.floor(cb*f));
  },
  rgb2hsv : function(rgb){
   rgb = rgb.replace('#','');
   red = jslous.color.codeConvert(rgb.substr(0,2),16,10).length > 0 ? jslous.color.codeConvert(rgb.substr(0,2),16,10)/255:0;
   green = jslous.color.codeConvert(rgb.substr(2,2),16,10).length > 0 ? jslous.color.codeConvert(rgb.substr(2,2),16,10)/255:0;
   blue = jslous.color.codeConvert(rgb.substr(4,2),16,10).length > 0 ? jslous.color.codeConvert(rgb.substr(4,2),16,10)/255:0;
   max = Math.max(red,green,blue);
   min = Math.min(red,green,blue);
   var hue = (max == min ? 0:(red == max ? (green-blue)/(max-min)/1:green == max ? 2+(blue-red)/1/(max-min)/1:blue == max ? 4+(red-green)/(max-min)/1:0));
   var saturate = (max-min)/max;
   hue = hue*60; 
   bright = max;
   return { h : hue,s : saturate,v : bright };
  },
  hsv2rgb : function(hsv){
   var gethex = function(part){
    if(hsv.s == 0){ part = hsv.v; }
    part = jslous.color.codeConvert((Math.round(part*255)),10,16)+'';
    while(part.length < 2){ part = '0'+part; }
    return part;
   };
   tmp = {};
   tmp.Hi = (hsv.h == 360 ? 0:Math.floor(hsv.h/60));
   tmp.f = hsv.h/60-tmp.Hi;
   tmp.p = (hsv.v*(1-hsv.s)).toPrecision(2);
   tmp.q = (hsv.v*(1-(tmp.f*hsv.s))).toPrecision(2);
   tmp.t = (hsv.v*(1-((1-tmp.f)*hsv.s))).toPrecision(2);
   switch(tmp.Hi){
    case 0: red = hsv.v; green = tmp.t; blue = tmp.p; break;
    case 1: red = tmp.q; green = hsv.v; blue = tmp.p; break;
    case 2: red = tmp.q; green = hsv.v; blue = tmp.t; break;
    case 3: red = tmp.p; green = tmp.q; blue = hsv.v; break;
    case 4: red = tmp.t; green = tmp.p; blue = hsv.v; break;
    case 5: red = hsv.v; green = tmp.p; blue = tmp.q; break;
   }
   delete tmp;
   return '#'+gethex(red)+''+gethex(green)+''+gethex(blue).toUpperCase();
  }
 }
 
 /* canvasengine */
 jslous.canvas = {
  addnamespace : function(){
   var vmlstyle = document.createStyleSheet(),vml = ['shape','shapetype','group','background','path','formulas','handles','fill','stroke','shadow','textbox','textpath','imagedata','line','polyline','curve','roundrect','oval','rect','arc','image'];
   for(var i = 0;i < vml.length;i++){ vmlstyle.addRule('v\\:'+vml[i],'behavior: url(#default#VML);'); }
   document.namespaces.add('v','urn:schemas-microsoft-com:vml');
  },
  createCanvas : function(img,width,height,putWidth,putHeight,current){
   if(jslous.Agents.ie && document.namespaces){
	if(document.namespaces['v'] == null){ jslous.canvas.addnamespace(); }
	var display= jslous.css.current(img,'display').toLowerCase() == 'block' ? 'block':'inline-block';
	var canvas = document.createElement('var');
	jslous.css.setstyles(canvas,{ zoom:1,overflow:'hidden',display:display,width:width+'px',height:height+'px',padding:0 });
	var float = jslous.css.current(img,(jslous.Agents.ie ? 'styleFloat':'float')).toLowerCase();
    canvas.dpl = (float == 'left' || float == 'right') ? 'inline':display;
   }else{
	var canvas = document.createElement('canvas');
   }
   if(canvas || canvas.getContext('2d')){
	var attr = { opt:current,id:img.id,alt:img.alt,title:img.title,source:img.src,width:width,naturalWidth:putWidth,height:height,naturalHeight:putHeight,className:img.className,prv:img.cloneNode(true) }
	for(var at in attr){ if(attr[at]){ canvas[at] = attr[at]; } }  
	canvas.style.cssText = img.style.cssText;
	jslous.css.setstyles(canvas,{ width : width+'px',height : height+'px' });
   }
   return canvas;
  },
  ellipse : function(canv,x1,y1,x2,y2){
   var kp = 4*((Math.sqrt(2)-1)/3),rx=(x2-x1)/2,ry=(y2-y1)/2,cx=x1+rx,cy=y1+ry;
   canv.beginPath();
   canv.moveTo(cx,cy-ry);
   canv.bezierCurveTo(cx+(kp*rx),cy-ry,cx+rx,cy-(kp*ry),cx+rx,cy);
   canv.bezierCurveTo(cx+rx,cy+(kp*ry),cx+(kp*rx),cy+ry,cx,cy+ry);
   canv.bezierCurveTo(cx-(kp*rx),cy+ry,cx-rx,cy+(kp*ry),cx-rx,cy);
   canv.bezierCurveTo(cx-rx,cy-(kp*ry),cx-(kp*rx),cy-ry,cx,cy-ry);
   canv.closePath();
   return false;
  },
  RadialGradient : function(ctx,x1,y1,r1,x2,y2,r2,array){
   if(!ctx || !jslous.is_array(array)){ return false; }
   var tmp = ctx.createRadialGradient(x1,y1,r1,x2,y2,r2);
   for(var i = 0,len = array.length;i < len;i++){ tmp.addColorStop(array[i]['offset'],array[i]['color']); }
   return tmp;
  },
  LinearGradient : function(ctx,x,y,w,h,array){
   if(!ctx || !jslous.is_array(array)){ return false; }
   var tmp = ctx.createLinearGradient(x,y,w,h);
   for(var i = 0,len = array.length;i < len;i++){ tmp.addColorStop(array[i]['offset'],array[i]['color']); }
   return tmp;
  },
  quadraticCurve : function(ctx,array){
   if(!ctx || !array){ return false; }
   for(var i = 0,len = array.length;i < len;i++){
    ctx.lineTo(array[i]['s'],array[i]['e']);
    ctx.quadraticCurveTo(array[i]['x'],array[i]['y'],array[i]['w'],array[i]['h']);
   }
  },
  roundedRect : function(ctx,x,y,width,height,radius,nopath){
   if(!nopath){ ctx.beginPath(); }
   ctx.moveTo(x,y+radius);
   jslous.canvas.quadraticCurve(ctx,[{s:x,e:y+height-radius,x:x,y:y+height,w:x+radius,h:y+height},{s:x+width-radius,e:y+height,x:x+width,y:y+height,w:x+width,h:y+height-radius},{s:x+width,e:y+radius,x:x+width,y:y,w:x+width-radius,h:y},{s:x+radius,e:y,x:x,y:y,w:x,h:y+radius}]);
   if(!nopath){ ctx.closePath(); }
  },
  shadow : function(ctx,x,y,width,height,radius,opacity){
   var style,os = radius/2,fill = [{offset:0,color:'rgba(0,0,0,'+(Math.min(parseFloat(opacity+0.1),1.0))+')'},{offset:0.25,color:'rgba(0,0,0,'+opacity+')'},{offset:1,color:'rgba(0,0,0,0)'}]; 
   var rect = function(ctx,x,y,w,h,fill){
    ctx.beginPath();
    ctx.rect(x,y,w,h);
    ctx.closePath();    
    ctx.fillStyle = fill;
    ctx.fill();
   }   
   rect(ctx,x+radius,y,width-(radius*2),y+os,jslous.canvas.LinearGradient(ctx,x+radius,y+os,x+radius,y,fill));
   rect(ctx,x,y,radius,radius,jslous.canvas.RadialGradient(ctx,x+radius,y+radius,radius-os,x+radius,y+radius,radius,fill));
   rect(ctx,x,y+radius,os,height-(radius*2),jslous.canvas.LinearGradient(ctx,x+os,y+radius,x,y+radius,fill));
   rect(ctx,x,y+height-radius,radius,radius,jslous.canvas.RadialGradient(ctx,x+radius,y+height-radius,radius-os,x+radius,y+height-radius,radius,fill)); 
   rect(ctx,x+radius,y+height-os,width-(radius*2),os,jslous.canvas.LinearGradient(ctx,x+radius,y+height-os,x+radius,y+height,fill));
   rect(ctx,x+width-radius,y+height-radius,radius,radius,jslous.canvas.RadialGradient(ctx,x+width-radius,y+height-radius,radius-os,x+width-radius,y+height-radius,radius,fill));
   rect(ctx,x+width-os,y+radius,os,height-(radius*2),jslous.canvas.LinearGradient(ctx,x+width-os,y+radius,x+width,y+radius,fill));
   rect(ctx,x+width-radius,y,radius,radius,jslous.canvas.RadialGradient(ctx,x+width-radius,y+radius,radius-os,x+width-radius,y+radius,radius,fill));
  },
  gloss : {
   defaults : { radius:25,color:'#FFFFFF',gradient:'#FFFFFF',direction:'v',shade:50,shadow:40,width:null,height:null,gloss:true,noshadow:false,noradius:false,show:true },
   Listener : function(img,opt){
    if(img.tagName.toLowerCase() == 'img'){
     var current = {};
     for(var key in this.defaults){
      current[key] = typeof opt[key] != 'undefined' ? opt[key]:this.defaults[key];
      if(typeof opt[key] != 'undefined'){ delete opt[key]; }
     }
     current['width'] = current['width'] ? current['width']:img.width ? img.width:img.naturalWidth;
     current['height'] = current['height'] ? current['height']:img.height ? img.width:img.naturalHeight;
     try{
      var obj = img.parentNode;
	  var canvas = jslous.canvas.createCanvas(img,current['width'],current['height'],current['width'],current['height'],current);    
      obj.replaceChild(canvas,img);
      return this.transform(canvas,current);
     }catch(e){}     
    }
   },
   transform : function(canvas,opt){
    var regrgb = /^#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i;
    var color = opt['color'].match(regrgb) ? opt['color']:'#FFFFFF',gradient = opt['gradient'].match(regrgb) ? opt['gradient']:'#FFFFFF';
    opt['direction'] = opt['direction'].match(/^[dhv]/i) ? opt['direction'].substr(0,1):'v';
    opt['shadow'] = opt['shadow'] == 0 ? 0.0:opt['shadow']/100;
    opt['shade'] = opt['shade'] < 0.01 ? 0.0:Math.max(Math.min(opt['shade'],100),1)/100;
    var iw = canvas.width,ih = canvas.height,f = opt['radius'] > 0 ? Math.min(Math.max(opt['radius'],1),50)/100:0.25,angle = 0,xr = 0,sr,r,os,is,style,head,foot,fill = '';
	if(jslous.Agents.ie && document.namespaces){
	 opt['radius'] = Math.round(45*f);
	 xr = Math.round(Math.max(Math.round((Math.min(iw,ih)/2)*f),4)/4)*4;
	}else {
	 opt['radius'] = Math.max(Math.round((Math.min(iw,ih)/2)*f),4);
	}	
	if(!opt['noshadow']){
	 opt['radius'] = jslous.Agents.ie ? opt['radius']:Math.round(opt['radius']/4)*4;
	 os = jslous.Agents.ie ? xr/4:opt['radius']/4;
	 sr = opt['radius']*0.75;
	 is = os;
	 r = sr;
	 sr = r*0.75;
	}else{
	 os = jslous.Agents.ie ? xr/4:opt['radius']/4;
	 r = opt['radius'];
	 is = 0;
	 sr = opt['radius']*0.75;
	}
	if(opt['noradius']){ r = 0; sr = 0; os = 0; is = 0; }
	if(jslous.Agents.ie && document.namespaces){
	 if(canvas.tagName.toLowerCase() == 'var'){
	  fill = '<v:roundrect arcsize="'+r+'%" strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:'+is+'px;width:'+(iw-(2*is))+'px;height:'+(ih-(2*is))+'px;">'+(color != gradient ? '<v:fill method="sigma" type="gradient" angle="'+(opt['direction'] == 'h' ? 90:opt['direction'] == 'd' ? 45:angle)+'" color="'+gradient+'" color2="'+color+'" /></v:roundrect>':'<v:fill color="'+color+'" /></v:roundrect>');
	  head = '<v:group style="zoom:1;display:'+canvas.dpl+';margin:0;padding:0;position:relative;width:'+iw+'px;height:'+ih+'px;" coordsize="'+iw+','+ih+'">'+(!opt['noshadow'] && !opt['noradius'] ? '<v:rect strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+iw+'px;height:'+ih+'px;"><v:fill color="#ffffff" opacity="0" /></v:rect>':'');				
	  foot = '<v:roundrect arcsize="'+r+'%" strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:'+is+'px;width:'+(iw-(2*is))+'px;height:'+(ih-(2*is))+'px;"><v:fill src="'+canvas.source+'" type="frame" /></v:roundrect><v:roundrect arcsize="'+(sr*2)+'%" strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+os+'px;left:'+(os+is)+'px;width:'+(iw-(2*os)-(2*is))+'px;height:'+((ih/2)-os-is)+'px;"><v:fill method="linear" type="gradient" angle="0" color="#ffffff" opacity="'+(opt['gloss'] ? opt['shade']*0.25:0)+'" color2="#ffffff" o:opacity2="'+(opt['gloss'] ? opt['shade']*1.5:0)+'" /></v:roundrect><v:roundrect arcsize="'+(r*2)+'%" strokeweight="0" filled="t" stroked="f" fillcolor="#000000" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+((ih/2)-is)+'px;left:'+is+'px;width:'+(iw-(2*is))+'px;height:'+((ih/2)-is)+'px;"><v:fill method="sigma" type="gradient" angle="180" color="#000000" opacity="0" color2="#000000" o:opacity2="'+opt['shade']+'" /></v:roundrect></v:group>';
	  canvas.innerHTML = head+(!opt['noshadow'] && !opt['noradius'] ? '<v:roundrect arcsize="'+r+'%" strokeweight="0" filled="t" stroked="f" fillcolor="#000000" style="filter:Alpha(opacity='+(opt['shadow']*100)+'), progid:dxImageTransform.Microsoft.Blur(PixelRadius='+is+', MakeShadow=false); zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+is+'px;left:0px;width:'+(iw-(2*is))+'px;height:'+(ih-(3*is))+'px;"><v:fill color="#000000" opacity="1" /></v:roundrect>':'')+fill+foot;
	 }
	}else if(canvas.tagName.toLowerCase() == 'canvas' && canvas.getContext('2d')){
	 var context = canvas.getContext('2d');
	 var img = new Image();
	 jslous.Event.Listener(img,'load',function(){
	  context.clearRect(0,0,iw,ih);
	  if(!opt['noshadow']){ jslous.canvas.shadow(context,0,0,iw,ih,opt['radius'],opt['shadow']); }
	  context.save();	  
	  jslous.canvas.roundedRect(context,is,0,iw-(is*2),ih-(is*2),r);
	  context.clip();
      if(color != gradient){
	   style = jslous.canvas.LinearGradient(context,0,0,(opt['direction'] == 'h' ? iw:opt['direction'] == 'd' ? iw-(is*2):0),(opt['direction'] == 'h' ? 0:ih-(is*2)),[{ offset:0,color:color },{ offset:1,color:gradient }]);
	   context.beginPath();
	   context.rect(0,0,iw,ih-(is*2));
	   context.closePath();
	   context.fillStyle = style;
	   context.fill();
	  }else{
	   context.fillStyle = color;
	   context.fillRect(0,0,iw,ih-(is*2));
	  }	  
	  context.drawImage(img,is,0,iw-(is*2),ih-(is*2));
	  if(opt['gloss']){
	   style = jslous.canvas.LinearGradient(context,0,os,0,os+sr,[{offset:0,color:'rgba(254,254,254,'+opt['shade']*1.5+')'},{offset:1,color:'rgba(254,254,254,0.1)'}]);
	   context.beginPath();
       jslous.canvas.roundedRect(context,os+is,os,iw-(2*(os+is)),(ih/2)-os,sr);
       context.closePath();
       context.fillStyle = style;
	   context.fill();
	   style = jslous.canvas.LinearGradient(context,0,(ih/2)-is,0,(ih/2)-is*2,[{offset:0,color:'rgba(0,0,0,0)'},{offset:1,color:'rgba(0,0,0,'+opt['shade']+')'}]);
	   var pos = {x:is,y:(ih/2)-is,w:iw-(2*is),h:(ih/2)-is,r:sr};
	   context.beginPath();
	   context.moveTo(pos['x'],pos['y']);
	   jslous.canvas.quadraticCurve(context,[{s:pos['x'],e:pos['y']+pos['h']-pos['r'],x:pos['x'],y:pos['y']+pos['h'],w:pos['x']+pos['r'],h:pos['y']+pos['h']},{s:pos['x']+pos['w']-pos['r'],e:pos['y']+pos['h'],x:pos['x']+pos['w'],y:pos['y']+pos['h'],w:pos['x']+pos['w'],h:pos['y']+pos['h']-pos['r']}]);
	   context.lineTo(pos['x']+pos['w'],pos['y']);
	   context.lineTo(pos['x'],pos['y']);
       context.closePath();
       context.fillStyle = style;
	   context.fill();
	   if(opt['noradius']){
	    jslous.canvas.roundedRect(context,is,0,iw-(is*2),ih-(is*2),r);
	    style = jslous.canvas.LinearGradient(context,0,0,0,ih-(is*2),[{offset:0,color:'rgba(254,254,254,'+(opt['shade']*0.5)+')'},{offset:1,color:'rgba(0,0,0,'+(opt['shade']*0.5)+')'}]);
	    context.lineWidth = (r+is)/2;
	    context.strokeStyle = style;
	    context.stroke();
	   }
       context.restore();
	  }	  
	  jslous.Event.removeListener(img,'load',arguments.callee);
	 });
	 img.src = canvas.source;
	}
	if(opt['show']){ canvas.style.visibility = 'visible'; }
	return canvas;
   }
  },
  globe : {
   defaults : { size:0,shine:100,shade:100,zoom:100,shift:50,color:'#FFFFFF',gradient:'#FFFFFF',opacity:100,show:true },
   Listener : function(img,opt){
    if(img.tagName.toLowerCase() == 'img'){
     var current = {};
     for(var key in this.defaults){
      current[key] = typeof opt[key] != 'undefined' ? opt[key]:this.defaults[key];
      if(typeof opt[key] != 'undefined'){ delete opt[key]; }
     }
	 if(img.naturalWidth && img.naturalHeight){
	  var putWidth = img.naturalWidth,putHeight = img.naturalHeight;
	 }else{
	  var tmp = new Image();
	  tmp.src = img.src;
	  var putWidth = img.width,putHeight = img.height;
	  delete tmp;
	 }
     var size= jslous.is_num(current['size']) ? current['size']:this.defaults['size'];
     if(size <= 0){ size = Math.max(32,(putWidth > putHeight ? img.height:putHeight > putWidth ? img.width:img.height)); }
     if(size < 32){ size = 32; }
     try{
	  var obj = img.parentNode;
	  var canvas = jslous.canvas.createCanvas(img,size,size,putWidth,putHeight,current);
	  obj.replaceChild(canvas,img);
      return this.transform(canvas,current);
	 }catch(e){}
    }
   },
   transform : function(canvas,opt){  
    try{
     var regrgb = /^#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i;
     var color = opt['color'].match(regrgb) ? opt['color']:'#FFFFFF',gradient = opt['gradient'].match(regrgb) ? opt['gradient']:'#FFFFFF';
     var sz = canvas.width,nw = canvas.naturalWidth,nh = canvas.naturalHeight,nx = 0,ny = 0,xx = 0,yy = 0,xo = 0.5,yo = 0.5;
     var sf = opt['shift'] <= 0.01 ? 0:opt['shift'] >= 100 ? 1:opt['shift']/100,zz= opt['zoom'] < 100 ? 1:opt['zoom'] > 200 ? 2:opt['zoom']/100;
     var zo=(zz-1)*.5,lw=0.4,st='';
     if(nw > nh){
      nx = (nw-nh)*sf; xo = 1-(sz/nw); xx = (xo*-0.5)+(sf*xo); xo = sf; nw = nh;
     }else if(nh > nw){
      ny = (nh-nw)*sf; yo = 1-(sz/nh); yy = (yo*-0.5)+(sf*yo); yo = sf; nh = nw;
     }
     var fc = 0.85,iw = Math.round(sz*fc),ih = iw,ic = ih/2,os = (sz-iw)/2,op = opt['opacity'] == 0 ? 0.0:opt['opacity']/100,sh = opt['shade'] == 0 ? 0.0:opt['shade']/100,sd = opt['shine'] == 0 ? 0.0:opt['shine']/100,gc = jslous.color.hex2rgb(isNaN(gradient) ? gradient:(isNaN(color) ? color:this.defaults['color']),1-op);
	 if(jslous.Agents.ie && document.namespaces){
	  var head,foot,shadow,border,shades,shines,frame,fill = '',gc = jslous.color.hex2rgb(isNaN(gradient) ? gradient:(isNaN(color) ? color:this.defaults['color']),0.3);
	  if(canvas.tagName.toLowerCase() == 'var'){
	   head = '<v:group style="zoom:1;display:'+canvas.dpl+';margin:0;padding:0;position:relative;width:'+sz+'px;height:'+sz+'px;" coordsize="'+sz+','+sz+'"><v:rect strokeweight="0" filled="f" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+sz+'px;height:'+sz+'px;"></v:rect>';
	   foot = '</v:group>';
	   if(isNaN(color)){ fill = '<v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:fill color2="'+color+'" color="'+(isNaN(gradient) ? gradient:color)+'" type="gradient" method="sigma" angle="20" focus="0" focussize="0,0" focusposition="1,1" on="t" /></v:oval>'; }
	   shades = '<v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:fill opacity="0" color="black" color2="black" o:opacity2="'+(sh*.5)+'" type="gradient" method="any" angle="0" focus="0" focussize="0.2,0.2" focusposition="0.4,0.4" on="t" /></v:oval><v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:fill opacity="'+(sh*.5)+'" color="black" color2="black" o:opacity2="0" type="gradientradial" method="linear" focus="0" focussize="0.75,0.75" focusposition="0.125,0.125" on="t" /></v:oval>';
	   shines='<v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:fill opacity="0" color="white" color2="white" o:opacity2="'+(sd*.66)+'" type="gradientradial" method="sigma" focus="0" focussize="0,0" focusposition="0.8,0.8" on="t" /></v:oval><v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+(sz*.48)+'px;left:'+(sz*.51)+'px;width:'+(sz*.3125)+'px;height:'+(sz*.3125)+'px;"><v:fill opacity="0" color="white" color2="white" o:opacity2="'+sd+'" type="gradientradial" method="sigma" focus="0" focussize="0,0" focusposition="0.5,0.5" on="t" /></v:oval><v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+(sz*.04)+'px;left:'+(sz*.24)+'px;width:'+(sz*.52)+'px;height:'+(sz*.36)+'px;"><v:fill opacity="0" color="white" color2="white" o:opacity2="'+sd+'" type="gradient" method="any" angle="20" focus="0" focussize="0.2,0.2" focusposition="0.4,0.4" on="t" /></v:oval>';
	   border='<v:oval filled="f" fillcolor="transparent" stroked="t" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:stroke weight="1" style="single" color="'+gc+'" opacity="'+Math.max(0.5,op)+'" /></v:oval>';
	   shadow='<v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:'+(sz*.7)+'px;left:'+(sz*.1)+'px;width:'+(sz*.8)+'px;height:'+(sz*.3)+'px;"><v:fill opacity="'+sh+'" color="'+(isNaN(gradient) ? gradient:isNaN(color) ? color:'black')+'" color2="black" colors="'+(10-(op*10))+'% '+(isNaN(gradient) ? gradient:isNaN(color) ? color:'black')+'" o:opacity2="0" type="gradientradial" method="linear" focus="0" focussize="0,0" focusposition="0.5,0.5" on="t" /></v:oval>';
	   frame='<v:oval filled="t" stroked="f" strokeweight="0" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:1px;left:'+os+'px;width:'+iw+'px;height:'+ih+'px;"><v:fill opacity="'+op+'" src="'+canvas.source+'" type="frame" aspect="atleast" size="'+zz+','+zz+'" origin="'+xx+','+yy+'" position="0,0" /></v:oval>';
	   canvas.innerHTML = head+shadow+fill+frame+shades+shines+border+foot;
	  }
	 }else if(canvas.tagName.toLowerCase() == 'canvas' && canvas.getContext('2d')){
	  var context = canvas.getContext('2d');
	  var img = new Image();
	  jslous.Event.Listener(img,'load',function(){
	   context.clearRect(0,0,sz,sz);
	   context.save();
  	   context.translate(0,sz*.64);
  	   context.scale(1,0.425);
  	   st = jslous.canvas.RadialGradient(context,os+ic,ic,1,os+ic,ic,ic,[{offset:0,color:'rgba(0,0,0,'+sh+')'},{offset:.8,color:'rgba('+gc+','+(sh*.125)+')'},{offset:1,color:'rgba('+gc+',0)'}]);
	   context.fillStyle = st;
	   jslous.Agents.webkit ? context.fill():context.fillRect(0,0,sz,sz);
	   context.restore();
	   context.save();
	   context.beginPath();
	   context.arc(os+ic,ic+lw,ic,0,(Math.PI/180)*360,true);
	   context.closePath();
	   context.clip();
	   context.clearRect(0,0,sz,sz);
       if(color != gradient){
	    st = jslous.canvas.LinearGradient(context,ic,0,ic+(3*os),ih,[{offset:0,color:color},{offset:1,color:gradient}]);		  
	    context.fillStyle = st; 
	    jslous.Agents.webkit ? context.fill():context.fillRect(os,0,iw,ih);
	   }else{
		context.fillStyle = color;
		context.fillRect(os,0,iw,ih);
	   }
	   context.globalAlpha = op;
	   context.drawImage(img,nx+(nw*(zo*xo)),ny+(nh*(zo*yo)),nw*(1-zo),nh*(1-zo),os,0,iw,ih);
	   context.globalAlpha = 1.0;
	   st = jslous.canvas.LinearGradient(context,ic,0,ic+(3*os),ih,[{offset:0,color:'rgba(0,0,0,'+(sh*.5)+')'},{offset:1,color:'rgba(0,0,0,0)'}]);
	   context.fillStyle = st;
	   jslous.Agents.webkit ? context.fill():context.fillRect(0,0,sz,sz);
	   st = jslous.canvas.RadialGradient(context,os+ic,ic,ic-(1.5*os),os+ic,ic,ic,[{offset:0,color:'rgba(0,0,0,0)'},{offset:1,color:'rgba(0,0,0,'+(sh*.5)+')'}]);
	   context.fillStyle = st;
	   jslous.Agents.webkit ? context.fill():context.fillRect(0,0,sz,sz);
	   st = jslous.canvas.RadialGradient(context,(3*os)+ic,(3.5*os)+ic,os*.5,(2.5*os)+ic,(3*os)+ic,ic-os,[{offset:0,color:'rgba(255,255,255,'+sd+')'},{offset:0.25,color:'rgba(255,255,255,'+(sd*.666666)+')'},{offset:1,color:'rgba(255,255,255,0)'},]);
	   context.fillStyle=st;
	   jslous.Agents.webkit ? context.fill():context.fillRect(0,0,sz,sz);		
	   context.restore();
	   context.save();
	   st = jslous.canvas.LinearGradient(context,(iw/2)-os,os*.5,(iw/2)+os,(os*.5)+ic,[{offset:0,color:'rgba(255,255,255,'+sd+')'},{offset:1,color:'rgba(255,255,255,0)'}]);
	   jslous.canvas.ellipse(context,os+(ic/2.5),os*.5,os+(ic/2.5)+(ic*1.2),(os*.5)+(ic*.9));
	   context.fillStyle = st;
	   context.fill();
	   context.restore();
	   context.save();
	   context.beginPath();
	   context.arc(os+ic,ic+lw,ic,0,(Math.PI/180)*360,true);
	   context.closePath();
	   context.strokeStyle = 'rgba('+gc+','+op+')';
	   context.lineWidth = lw;
	   context.stroke();
	   context.restore();
	   jslous.Event.removeListener(img,'load',arguments.callee);
	  });
	  img.src = canvas.source;
	 }
	 if(opt['show']){ canvas.style.visibility = 'visible'; }
	 return canvas;
	}catch(e){}
   }
  }
 }
  
 /* motion engine */
 jslous.func.extend({
  motion : {
   looping : false,
   fsp : 60,
   box : [],
   percent : 0,
   regcolor : /color/i,
   regalpha : /opacity/i,
   defaults : { time : 1, effect : null, delay : 0, prefix : {}, suffix : {}, go : undefined, goopt : undefined, upd : undefined, updopt : undefined, comp : undefined, compopt : undefined },
   inited : false,
   tweens : {},
   init : function(){
    this.inited = true;
    for(var key in this.tween){ this.tweens[key.toLowerCase()] = this.tween[key]; }
   },
   Listener : function(obj,opts){
    var self = this;
    if(!this.inited){ this.init(); }
    var current = { target : obj,props : {} };   
    for(var key in this.defaults){
     if(typeof opts[key] != 'undefined') {
      current[key] = opts[key];
      delete opts[key];
     }else{
      current[key] = this.defaults[key];
     }
    }
    current.tweeny = (jslous.is_func(current.effect)) ? current.effect:current.effect ? this.tweens[current.effect.toLowerCase()]:this.tweens[jslous.objrandom(this.tweens).toLowerCase()];
    for(var key in opts){
     if(key.match(this.regcolor)){
      var from = jslous.color.hex2num(opts[key].from);
      var to = jslous.color.hex2num(opts[key].to);
      current.props[jslous.camelize(key)] = {
       r : { begin : from.r || 0,change : to.r-from.r,unit : '' },g : { begin : from.g || 0,change : to.g-from.g,unit : '' },b : { begin : from.b || 0,change : to.b-from.b,unit : '' }
      }
     }else{
     current.props[jslous.camelize(key)] = { begin : opts[key].from || 0,change : opts[key].to-opts[key].from,end : opts[key].to,unit : opts[key].unit || 'px' };
     }
    }
    setTimeout(function(){
     current.run = (new Date()-0);
     current.exit = current.time*1000+current.run;
     if(jslous.is_func(current.go)){ (current.goopt) ? current.go.apply(current,current.goopt):current.go(); }
     self.box.push(current);
     if(!self.looping){
      self.looping = true;
      self.wheel.call(self);
     }
    },current.delay*1000);
   },
   wheel : function(){
    var now = (new Date()-0);
    for(var i = 0;i < this.box.length;i++){
     var active = this.box[i],time = now-active.run,duration = active.exit-active.run;
     if(time >= duration){
      for(var prop in active.props){
       var tmp = active.props[prop];
       var val = (prop.match(this.regcolor)) ? '#'+jslous.color.num2hex(Math.floor(tmp.r.begin+tmp.r.change+.5))+jslous.color.num2hex(Math.floor(tmp.g.begin+tmp.g.change+.5))+jslous.color.num2hex(Math.floor(tmp.b.begin+tmp.b.change+.5)):tmp.begin+tmp.change+tmp.unit;
       try{
        (prop.match(this.regalpha) ? (jslous.Agents.ie ? active.target.filter = 'alpha(opacity='+parseInt(val)+')':jslous.Agents.webkit ? active.target.opacity = parseInt(val)/100:active.target.MozOpacity = parseInt(val)/100):active.target[prop] = (val)+tmp.unit);
       }catch(e){}
      }
      this.box.splice(i,1);
      if(jslous.is_func(active.upd)){ (active.updopt) ? active.upd.apply(active,active.updopt):active.upd(); }
      if(jslous.is_func(active.comp)){ (active.compopt) ? active.comp.apply(active,active.compopt):active.comp(); }
     }else{
      for(var prop in active.props){
       var tmp = active.props[prop];
       var val = (prop.match(this.regcolor)) ? '#'+jslous.color.num2hex(Math.floor(active.tweeny(time,tmp.r.begin,tmp.r.change,duration)+.5))+jslous.color.num2hex(Math.floor(active.tweeny(time,tmp.g.begin,tmp.g.change,duration)+.5))+jslous.color.num2hex(Math.floor(active.tweeny(time,tmp.b.begin,tmp.b.change,duration)+.5)):active.tweeny(time,tmp.begin,tmp.change,duration)+tmp.unit;
       try{
        (prop.match(this.regalpha) ? (jslous.Agents.ie ? active.target.filter = 'alpha(opacity='+parseInt(val)+')':jslous.Agents.webkit ? active.target.opacity = parseInt(val)/100:active.target.MozOpacity = parseInt(val)/100):active.target[prop] = val);
       }catch(e){
       }
      }
      if(jslous.is_func(active.upd)){ (active.updopt) ? active.upd.apply(active,active.updopt):active.upd(); }
     }
    }
    if(this.box.length > 0){
     var self = this;
     setTimeout(function(){ self.wheel(); },1000/self.fsp);
    }else{
     this.looping = false;
    }
   },
   util : {
    bezier : function(t,p0,p1,p2){ return (1-t)*(1-t)*p0+2*t*(1-t)*p1+t*t*p2; },
    bezier2 : function(t,p0,p1,p2,p3){ return Math.pow(1-t,3)*p0+3*t*Math.pow(1-t,2)*p1+3*t*t*(1-t)*p2+t*t*t*p3; }
   },
   tween : {
    liner : function(time,begin,change,duration){ return change*time/duration+begin; },
    quadin : function(time,begin,change,duration){ return change*(time/=duration)*time+begin; },
    quadout : function(time,begin,change,duration){ return -change*(time/=duration)*(time-2)+begin; },
    quadboth : function(time,begin,change,duration){ return (((time/=duration/2) < 1) ? change/2*time*time+begin:-change/2*((--time)*(time-2)-1)+begin); },
    cubicin : function(time,begin,change,duration){ return change*(time/=duration)*time*time+begin; },
    cubicout : function(time,begin,change,duration){ return change*((time=time/duration-1)*time*time+1)+begin; },
    cubicinout : function(time,begin,change,duration){ return (((time/=duration/2) < 1) ? change/2*time*time*time+begin:change/2*((time-=2)*time*time+2)+begin); },
    cubicoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.cubicout(time*2,begin,change/2,duration):jslous.func.motion.tween.cubicin((time*2)-duration,begin+change/2,change/2,duration)); },
    quartin : function(time,begin,change,duration){ return change*(time/=duration)*time*time*time+begin; },
    quartout : function(time,begin,change,duration){ return -change*((time=time/duration-1)*time*time*time-1)+begin; },
    quartinout : function(time,begin,change,duration){ return (((time/=duration/2) < 1) ? change/2*time*time*time*time+begin:change/2*((time-=2)*time*time*time-2)+begin); },
    quartoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.quartout(time*2,begin,change/2,duration):jslous.func.motion.tween.quartin((time*2)-duration,begin+change/2,change/2,duration)); },
    quintin : function(time,begin,change,duration){ return change*(time/=duration)*time*time*time*time+begin; },
    quintout : function(time,begin,change,duration){ return change*((time=time/duration-1)*time*time*time*time+1)+begin; },
    quintinout : function(time,begin,change,duration){ return (((time/=duration/2) < 1) ? change/2*time*time*time*time*time+begin:change/2*((time-=2)*time*time*time*time+2)+begin); },
    quintoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.quintout(time*2,begin,change/2,duration):jslous.func.motion.tween.quintin((time*2)-duration,begin+change/2,change/2,duration)); },
    sinein : function(time,begin,change,duration){ return -change*Math.cos(time/duration*(Math.PI/2))+change+begin; },
    sineout : function(time,begin,change,duration){ return change*Math.sin(time/duration*(Math.PI/2))+begin; },
    sineinout : function(time,begin,change,duration){ return -change/2*(Math.cos(Math.PI*time/duration)-1)+begin; },
    sineoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.sineout(time*2,begin,change/2,duration):jslous.func.motion.tween.sinein((time*2)-duration,begin+change/2,change/2,duration)); },
    expoin : function(time,begin,change,duration){ return (time == 0) ? begin:change*Math.pow(2,10*(time/duration-1))+begin-change*0.001; },
    expoout : function(time,begin,change,duration){ return (time == duration) ? begin+change:change*1.001*(-Math.pow(2,-10*time/duration)+1)+begin; },
    expoinout : function(time,begin,change,duration){ return ((time == 0) ? begin:(time == 0) ? begin+change:((time/=duration/2) < 1) ? change/2*Math.pow(2,10*(time-1))+begin-change*0.0005:change/2*1.0005*(-Math.pow(2,-10*--time)+2)+begin); },
    expooutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.expoout(time*2,begin,change/2,duration):jslous.func.motion.tween.expoin((time*2)-duration,begin+change/2,change/2,duration)); },
    circin : function(time,begin,change,duration){ return -change*(Math.sqrt(1-(time/=duration)*time)-1)+begin; },
    circout : function(time,begin,change,duration){ return change*Math.sqrt(1-(time=time/duration-1)*time)+begin; },
    circinout : function(time,begin,change,duration){ return (((time/=duration/2) < 1) ? -change/2*(Math.sqrt(1-time*time)-1)+begin:change/2*(Math.sqrt(1-(time-=2)*time)+1)+begin); },
    circoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.circout(time*2,begin,change/2,duration):jslous.func.motion.tween.circin((time*2)-duration,begin+change/2,change/2,duration)); },
    bouncein : function(time,begin,change,duration){ return change-jslous.func.motion.tween.bounceout(duration-time,0,change,duration)+begin; },
    bounceout : function(time,begin,change,duration){ return (((time/=duration) < (1/2.75)) ? change*(7.5625*time*time)+begin:(time < (2/2.75)) ? change*(7.5625*(time-=(1.5/2.75))*time+.75)+begin:(time < (2.5/2.75)) ? change*(7.5625*(time-=(2.25/2.75))*time+.9375)+begin:change*(7.5625*(time-=(2.625/2.75))*time+.984375)+begin); },
    bounceinout : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.bouncein(time*2,0,change,duration)*.5+begin:jslous.func.motion.tween.bounceout(time*2-duration,0,change,duration)*.5+change*.5 +begin); },
    bounceoutin : function(time,begin,change,duration){ return ((time < duration/2) ? jslous.func.motion.tween.bounceout(time*2,begin,change/2,duration):jslous.func.motion.tween.bouncein((time*2)-duration,begin+change/2,change/2,duration)); },
    elasticin : function(time,begin,change,duration,a,p){
     var s;
     if(time == 0){ return begin; }
     if((time/=duration) == 1){ return begin+change; }
     if(!p){ p = duration*.3; }
     if(!a || a < Math.abs(change)){
      a = change; s = p/4;
     }else{
      s = p/(2*Math.PI)*Math.asin(change/a);
     }
     return -(a*Math.pow(2,10*(time-=1))*Math.sin((time*duration-s)*(2*Math.PI)/p))+begin;
    },    
    elasticout : function(time,begin,change,duration,a,p){
     var s;
     if(time == 0){ return begin; }
     if((time/=duration) == 1){ return begin+change; }
     if(!p){ p = duration*.3; }
     if(!a || a < Math.abs(change)){
      a = change; s = p/4;
     }else{
      s = p/(2*Math.PI)*Math.asin(change/a);
     }
     return(a*Math.pow(2,-10*time)*Math.sin((time*duration-s)*(2*Math.PI)/p)+change+begin);
    },    
    elasticinout : function(time,begin,change,duration,a,p){
     var s;
     if(time == 0){ return begin; }
     if((time/=duration/2) == 2){ return begin+change; }
     if(!p){ p=duration*(.3*1.5); }
     if(!a || a < Math.abs(change)){
      a = change; s = p/4;
     }else{
      s = p/(2*Math.PI)*Math.asin(change/a);
     }
     return ((time < 1) ? -.5*(a*Math.pow(2,10*(time-=1))*Math.sin((time*duration-s)*(2*Math.PI)/p))+begin:a*Math.pow(2,-10*(time-=1))*Math.sin((time*duration-s)*(2*Math.PI)/p)*.5+change+begin);
    },    
    elasticoutin : function(time,begin,change,duration,a,p){ return ((time < duration/2) ? jslous.func.motion.tween.elasticout(time*2,begin,change/2,duration,a,p):jslous.func.motion.tween.elasticin((time*2)-duration,begin+change/2,change/2,duration,a,p)); },
    backin : function(time,begin,change,duration,s){
     if(s == undefined){ s = 1.70158; }
     return change*(time/=duration)*time*((s+1)*time-s)+begin;
    },
    backout : function(time,begin,change,duration,s){
     if(s == undefined){ s = 1.70158; }
     return change*((time=time/duration-1)*time*((s+1)*time+s)+1)+begin;
    },    
    backinout : function(time,begin,change,duration,s){
     if(s == undefined){ s = 1.70158; }
     return (((time/=duration/2) < 1) ? change/2*(time*time*(((s*=(1.525))+1)*time-s))+begin:change/2*((time-=2)*time*(((s*=(1.525))+1)*time+s)+2)+begin);
    },    
    backoutin : function(time,begin,change,duration,s){ return ((time < duration/2) ? jslous.func.motion.tween.backout(time*2,begin,change/2,duration,s):jslous.func.motion.tween.backin((time*2)-duration,begin+change/2,change/2,duration,s)); }
   }
  }
 });
 
 /* sliders */
 jslous.func.extend({  
  slider : {
   active : false,
   defaults : { init:null, initopt:[], handle:null, upper:null, lower:null, lefter:null, righter:null, move:null, moveopt:[], min:null, max:null, limit:null, pos:0, spd:40 },
   cxlDefaults : function(evt){
    jslous.Event.cancelBubble(evt);
    jslous.Event.preventDefault(evt);
   },
   freeallow : function(elm){
    var free = function(){ if(jslous.cache['slideallow']){ clearTimeout(jslous.cache['slideallow']); } };
    jslous.Event.Listener(elm,'mouseup',free);
    jslous.Event.Listener(elm,'mouseout',free);
   },
   initirizer : function(interface,opt){
    var current = { target:opt, interface:interface };
    for(var key in this.defaults){
     current[key] = typeof opt[key] != 'undefined' ? opt[key]:this.defaults[key];
     if(typeof opt[key] != 'undefined'){ delete opt[key]; }
    }
    return current;
   },
   horizontal : function(interface,opt){
    var self = this,current = self.initirizer(interface,opt);
    current['handle'] = jslous.query('.horizontalhandle',interface)[0];
    current['lefter'] = jslous.query('.lefter',interface)[0];
    current['righter'] = jslous.query('.righter',interface)[0];
    current['limit'] = current['handle'].parentNode.offsetWidth-current['handle'].offsetWidth;
    if(!current['max']){ current['max'] = current['limit']+current['handle'].offsetWidth; }
    if(!current['min']){ current['min'] = 0; }
    current['pos'] = 0;
    var margin = jslous.elmPos.left(current['handle'])+current['handle'].offsetWidth;
    if(jslous.is_func(current['init'])){ current['init'].apply(current,current['initopt']); }
    var scrolled = function(evt){
     if(!self.active){ return false; }
     jslous.Event.removeListener(document,'mousemove',scroller);
     jslous.Event.removeListener(document,'mouseup',scrolled);
     self.cxlDefaults(evt);
     self.active = false;
    }
    var scroller = function(evt){    
     if(!self.active){ return false; }
     current['pos'] = jslous.Event.clientX(evt)-parseInt(margin)-(parseInt(current['handle'].offsetWidth)/2);
     current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'left',current['pos']+'px'):false;
     if(jslous.is_func(current['move'])){
      var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
      current['moveopt'].unshift(value);
      current['move'].apply(current,current['moveopt']);
     }
     self.cxlDefaults(evt);
    }
    var scrollinit = function(evt){
     if(self.active){ return false; }
     self.active = true;
     jslous.Event.Listener(document,'mousemove',scroller);
     jslous.Event.Listener(document,'mouseup',scrolled);
     self.cxlDefaults(evt);
    }
    jslous.Event.Listener(current['handle'],'mousedown',scrollinit);
    jslous.Event.Listener(current['lefter'],'mousedown',function(){
     if(current['pos'] <= 0){ return false; }
      current['pos']-=parseInt(current['handle'].offsetHeight)/4;
      current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'left',current['pos']+'px'):false;
      if(jslous.is_func(current['move'])){
       var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
       current['moveopt'].unshift(value);
       current['move'].apply(current,current['moveopt']);
      }
      jslous.cache['slideallow'] = setTimeout(arguments.callee,current['spd']); 
    }); 
    self.freeallow(current['lefter']);
    jslous.Event.Listener(current['righter'],'mousedown',function(){
     if(current['pos'] >= current['limit']){ return false; }
      current['pos']+=parseInt(current['handle'].offsetHeight)/4;
      current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'left',current['pos']+'px'):false;
      if(jslous.is_func(current['move'])){
       var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
       current['moveopt'].unshift(value);
       current['move'].apply(current,current['moveopt']);
      }
      jslous.cache['slideallow'] = setTimeout(arguments.callee,current['spd']);
    });
    self.freeallow(current['righter']);
   },
   vertical : function(interface,opt){
    var self = this,current = self.initirizer(interface,opt);
    current['handle'] = jslous.query('.verticalhandle',interface)[0];
    current['upper'] = jslous.query('.upper',interface)[0];
    current['lower'] = jslous.query('.lower',interface)[0];
    current['limit'] = current['handle'].parentNode.offsetHeight-current['handle'].offsetHeight;
    if(!current['max']){ current['max'] = current['limit']+current['handle'].offsetHeight; }
    if(!current['min']){ current['min'] = 0; }
    current['pos'] = 0;
    var margin = jslous.elmPos.top(current['handle'])+current['handle'].offsetHeight;
    if(jslous.is_func(current['init'])){ current['init'].apply(current,current['initopt']); }
    var scrolled = function(evt){
     if(!self.active){ return false; }
     jslous.Event.removeListener(document,'mousemove',scroller);
     jslous.Event.removeListener(document,'mouseup',scrolled);
     self.cxlDefaults(evt);
     self.active = false;
    }    
    var scroller = function(evt){    
     if(!self.active){ return false; }
     current['pos'] = jslous.Event.clientY(evt)-parseInt(margin)-(parseInt(current['handle'].offsetHeight)/2);
     current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'top',current['pos']+'px'):false;
     if(jslous.is_func(current['move'])){
      var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
      current['moveopt'].unshift(value);
      current['move'].apply(current,current['moveopt']);
     }
     self.cxlDefaults(evt);
    }    
    var scrollinit = function(evt){
     if(self.active){ return false; }
     self.active = true;
     jslous.Event.Listener(document,'mousemove',scroller);
     jslous.Event.Listener(document,'mouseup',scrolled);
     self.cxlDefaults(evt);
    }
    jslous.Event.Listener(current['handle'],'mousedown',scrollinit);
    
    jslous.Event.Listener(current['upper'],'mousedown',function(){
     if(current['pos'] <= 0){ return false; }
      current['pos']-=parseInt(current['handle'].offsetHeight)/4;
      current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'top',current['pos']+'px'):false;
      if(jslous.is_func(current['move'])){
       var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
       current['moveopt'].unshift(value);
       current['move'].apply(current,current['moveopt']);
      }
      jslous.cache['slideallow'] = setTimeout(arguments.callee,current['spd']); 
    });
    self.freeallow(current['upper']); 
    jslous.Event.Listener(current['lower'],'mousedown',function(){
     if(current['pos'] >= current['limit']){ return false; }
      current['pos']+=parseInt(current['handle'].offsetHeight)/4;
      current['pos'] >= 0 && current['pos'] <= current['limit'] ? jslous.css.setstyle(current['handle'],'top',current['pos']+'px'):false;
      if(jslous.is_func(current['move'])){
       var value = current['pos'] >= 0 && current['pos'] <= current['limit'] ? Math.floor(current['pos']/current['limit']*(current['max']-current['min'])+current['min']):current['pos'] < 0 ? current['min']:current['pos'] > current['limit'] ? current['max']:false;
       current['moveopt'].unshift(value);
       current['move'].apply(current,current['moveopt']);
      }
      jslous.cache['slideallow'] = setTimeout(arguments.callee,current['spd']);
    });
    self.freeallow(current['lower']);
   }
  }
 });
 
 /* readyListener */
 if(jslous.Agents.firefox){
  if(!('readyState' in document)){
   document.readyState = 'loading';
   jslous.createReady = function(){
    document.readyState = 'interactive';
    jslous.Event.removeListener(document,'DOMContentLoaded',jslous.createReady);
   }
   jslous.Event.Listener(document,'DOMContentLoaded',jslous.createReady);
   jslous.createReady = function(){
    document.readyState = 'complete';
    jslous.Event.removeListener(window,'load',jslous.createReady);
   }
   jslous.Event.Listener(window,'load',jslous.createReady);
   delete jslous.createReady;
  }
 } 
 var ready = jslous.ready = function(func){
  if(ready.loaded){ return func(); }
  var observers = ready.observers;
  if(!observers){ observers = ready.observers = []; }
  observers[observers.length] = func; 
  if(ready.callback){ return; } 
  ready.callback = function(){
   if(ready.loaded){ return; }      
   ready.loaded = true;
   if(ready.timer){
    clearInterval(ready.timer);
    ready.timer = null;
   }
   var observers = ready.observers;
   for(var i = 0,length = observers.length;i < length;i++){
    var func = observers[i];
    observers[i] = null;
    func();
   }
   ready.callback = ready.observers = null;
  };
  if(document.readyState && jslous.Agents.webkit){
   ready.timer = setInterval(function(){
    var state = document.readyState;
    if(state == 'loaded' || state == 'complete'){ ready.callback(); }
   },50);
  }else if(document.readyState && jslous.Agents.ie){
   var src = (window.location.protocol == 'https:') ? '://0':'javascript:void(0)';
   document.write('<script type="text/javascript" defer="defer" src="'+src+'" '+'onreadystatechange="if (this.readyState == \'complete\') $.ready.callback();"'+'><\/script>'); 
  }else{
   try{
    jslous.Event.Listener(document,'DOMContentLoaded',ready.callback);
   }catch(e){}
   jslous.Event.Listener(window,'load',ready.callback);  
  }
 }
 
 var htmlQuery = function(selector,current){
 /* elementNodeList converting Array */
  var elm2array = function(elms,array,flg){
   array = array || new Array();
   for(var i = 0,len = elms.length;i < len;i++){
    if(elms[i].nodeType == 1){ elms[i].setAttribute('index',i); }
    array.push(elms[i]);
   }
   return array;
  }
  var trim = function(str){ return str.replace(/^[ ]+|[ ]+$/g,''); }
  current = current || document;
  /* regular expression of selector string */
  var reg = /^(\w*)([#|\.|\^]?)(\w*)=?["|']?([^"|^']*)["|']?$/;
  var result = new Array(),elms;
  if(!selector){
   result.push(document);
   return result;
  }
  var match = reg.exec(selector);
  var chk = { tag : match[1] || '*',unit : match[2],select : match[3],val : match[4] };
  /* getTagName */
  if(!chk.unit){ return elm2array(current.getElementsByTagName(chk.tag),result); }
  if(chk.unit == '#'){
   /* getID */
   result.push(document.getElementById(chk.select))
   return result;
  }else if(chk.unit == '.'){
   /* getClassName */
   if(document.getElementsByClassName){
    return function(className,tag,elm){
     var elements = elm.getElementsByClassName(className),nodeName = (tag && tag != '*') ? new RegExp("\\b"+tag+"\\b","i") : null,returnElements = [],current;
     for(var i = 0,il = elements.length;i < il;i+=1){
      current = elements[i];
      if(!nodeName || nodeName.test(current.nodeName)){ returnElements.push(current); }
     }
     return elm2array(returnElements,result);
    }(chk.select,chk.tag,current);
   }else if(document.evaluate){
    return function (className,tag,elm){
     var classes = className.split(" "),classesToCheck = "",xhtmlNamespace = "http://www.w3.org/1999/xhtml",
     namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace) ? xhtmlNamespace : null,returnElements = [],elements,node;
     for(var j = 0,jl = classes.length;j < jl;j+=1){ classesToCheck += "[contains(concat(' ', @class, ' '), ' "+classes[j]+" ')]"; }
     try{
      elements = document.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null);
     }catch(e){
      elements = document.evaluate(".//"+tag+classesToCheck,elm,null,0,null);
     }
     while((node = elements.iterateNext())){ returnElements.push(node); }
     return elm2array(returnElements,result);
    }(chk.select,chk.tag,current);
   }else{
    return function(className,tag,elm){
     var classes = className.split(" "),classesToCheck = [],elements = (tag === "*" && elm.all) ? elm.all:elm.getElementsByTagName(tag),current,returnElements = [],match;
     for(var k = 0,kl=classes.length;k < kl;k+=1){ classesToCheck.push(new RegExp("(^|\\s)"+classes[k]+"(\\s|$)")); }
     for(var l = 0,ll = elements.length;l < ll;l+=1){
      current = elements[l];
      match = false;
      for(var m = 0,ml=classesToCheck.length;m < ml;m+=1){
       match = classesToCheck[m].test(current.className);
       if(!match){ break; }
      }
      if(match){ returnElements.push(current); }
     }
     return elm2array(returnElements,result);
    }(chk.select,chk.tag,current);
   }
  }else if(chk.unit == '^'){
   /* getAttribute */
   if(document.evaluate){
    return function(attrname,attrval,tag,elm){
     var xhtmlNamespace = "http://www.w3.org/1999/xhtml",namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace) ? xhtmlNamespace:null,returnElements = [],elements,node;
     var xpath = chk.val ? './/'+tag+'[@'+attrname+'="'+trim(chk.val)+'"]':'.//'+tag+'[@'+attrname+']';
     try{
      elements = document.evaluate(xpath,elm,namespaceResolver,0,null);
     }catch (e){
      elements = document.evaluate(xpath,elm,null,0,null);
     }
     while((node = elements.iterateNext())){ returnElements.push(node); }
     return elm2array(returnElements,result);
    }(chk.select,chk.val,chk.tag,current);
   }else{
    return function(attrname,attrval,tag,elm){
     var elements = current.getElementsByTagName(tag),returnElements = [];
     attrname = trim(attrname);
     if(attrval){ attrval = trim(attrval); }
     for(var i = 0,len = elements.length;i < len;i++){
      if(elements.item(i).getAttribute(attrname)){
       if(!attrval){ returnElements.push(elements.item(i)); }
       else if(elements.item(i).getAttribute(attrname) == attrval){ returnElements.push(elements.item(i)); }
      }
     }
     return elm2array(returnElements,result);
    }(chk.select,chk.val,chk.tag,current);
   }
  }
 } 
 htmlQuery.filter = function(selector,current){
  if(jslous.is_obj(current)){
   var reg = /^(\w*)([#|\.|\^]?)(\w*)=?["|']?([^"|^']*)["|']?$/,match = reg.exec(selector);
   var chk = { tag : match[1].toUpperCase() || null,unit : match[2],select : match[3],val : match[4] },ret = [];
   var attr = chk.unit == '#' ? 'id':chk.unit == '.' ? (jslous.Agents.ie ? 'className':'class'):chk.unit == '^' ? chk.select:null;
   var val = chk.unit == '#' || chk.unit == '.' ? chk.select:chk.unit == '^' ? chk.val:null;
   var select = attr ? (chk.tag ? function(elm){ elm.tagName == chk.tag && ((val && elm.getAttribute(attr) && elm.getAttribute(attr) == val) || (!val && elm.getAttribute(attr))) ? ret.push(elm):false; }:function(elm){ (val && elm.getAttribute(attr) && elm.getAttribute(attr) == val) || (!val && elm.getAttribute(attr)) ? ret.push(elm):false; }):(function(elm){ if(elm.tagName == chk.tag){ ret.push(current[i]); } });
   for(var i = 0,len = current.length;i < len;i++){ if(current[i].nodeType == 1){ select(current[i]); } }
   return ret;
  }
 }
})();