/***plugins***/
/*json*/
// Copyright (C) 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @param {string} json per RFC 4627
 * @return {Object|Array}
 * @author Mike Samuel <mikesamuel@gmail.com>
 */
var jsonParse = (function () {
  var number
      = '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';
  var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
      + '|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';
  var string = '(?:\"' + oneChar + '*\")';

  // Will match a value in a well-formed JSON file.
  // If the input is not well-formed, may match strangely, but not in an unsafe
  // way.
  // Since this only matches value tokens, it does not match whitespace, colons,
  // or commas.
  var jsonToken = new RegExp(
      '(?:false|true|null|[\\{\\}\\[\\]]'
      + '|' + number
      + '|' + string
      + ')', 'g');

  // Matches escape sequences in a string literal
  var escapeSequence = new RegExp('\\\\(?:([^u])|u(.{4}))', 'g');

  // Decodes escape sequences in object literals
  var escapes = {
    '"': '"',
    '/': '/',
    '\\': '\\',
    'b': '\b',
    'f': '\f',
    'n': '\n',
    'r': '\r',
    't': '\t'
  };
  function unescapeOne(_, ch, hex) {
    return ch ? escapes[ch] : String.fromCharCode(parseInt(hex, 16));
  }

  // A non-falsy value that coerces to the empty string when used as a key.
  var EMPTY_STRING = new String('');
  var SLASH = '\\';

  // Constructor to use based on an open token.
  var firstTokenCtors = { '{': Object, '[': Array };

  return function (json) {
    // Split into tokens
    var toks = json.match(jsonToken);
    // Construct the object to return
    var result;
    var tok = toks[0];
    if ('{' === tok) {
      result = {};
    } else if ('[' === tok) {
      result = [];
    } else {
      throw new Error(tok);
    }

    // If undefined, the key in an object key/value record to use for the next
    // value parsed.
    var key;
    // Loop over remaining tokens maintaining a stack of uncompleted objects and
    // arrays.
    var stack = [result];
    for (var i = 1, n = toks.length; i < n; ++i) {
      tok = toks[i];

      var cont;
      switch (tok.charCodeAt(0)) {
        default:  // sign or digit
          cont = stack[0];
          cont[key || cont.length] = +(tok);
          key = void 0;
          break;
        case 0x22:  // '"'
          tok = tok.substring(1, tok.length - 1);
          if (tok.indexOf(SLASH) !== -1) {
            tok = tok.replace(escapeSequence, unescapeOne);
          }
          cont = stack[0];
          if (!key) {
            if (cont instanceof Array) {
              key = cont.length;
            } else {
              key = tok || EMPTY_STRING;  // Use as key for next value seen.
              break;
            }
          }
          cont[key] = tok;
          key = void 0;
          break;
        case 0x5b:  // '['
          cont = stack[0];
          stack.unshift(cont[key || cont.length] = []);
          key = void 0;
          break;
        case 0x5d:  // ']'
          stack.shift();
          break;
        case 0x66:  // 'f'
          cont = stack[0];
          cont[key || cont.length] = false;
          key = void 0;
          break;
        case 0x6e:  // 'n'
          cont = stack[0];
          cont[key || cont.length] = null;
          key = void 0;
          break;
        case 0x74:  // 't'
          cont = stack[0];
          cont[key || cont.length] = true;
          key = void 0;
          break;
        case 0x7b:  // '{'
          cont = stack[0];
          stack.unshift(cont[key || cont.length] = {});
          key = void 0;
          break;
        case 0x7d:  // '}'
          stack.shift();
          break;
      }
    }
    // Fail if we've got an uncompleted object.
    if (stack.length) { throw new Error(); }
    return result;
  };
})();
/**
 * jQuery.cookie()
 * $.cookie('the_cookie'); // get cookie
 * $.cookie('the_cookie', 'the_value'); // set cookie
 * $.cookie('the_cookie', 'the_value', { expires: 7 }); // set cookie with an expiration date seven days in the future
 * $.cookie('the_cookie', '', { expires: -1 }); // delete cookie
 * $.cookie('the_cookie', null); // delete cookie
 */
jQuery.cookie = function(name, value, options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length; i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
/*mousewheel*/(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
/*doTimeout*/(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var e=d.call(arguments),f=b.apply(this,[c+e[0]].concat(e));return e[2]?this:f};function b(j,f,h,m){var k=this,g,i,l=arguments;if(j){g=k.eq(0);g.data(j,i=g.data(j)||{})}else{i=a[f]||(a[f]={})}i.id&&clearTimeout(i.id);function e(){if(j){g.removeData(j)}else{delete a[f]}return true}if(m){i.fn=function(){e();return m.apply(k,d.call(l,4))};i.id=setTimeout(i.fn,h)}else{if(i.fn){return h?i.fn():e()}else{e()}}}})(jQuery);
/*productbrowser*/(function($){function fireEvent(opts,name,self,arg){var fn=opts[name];if($.isFunction(fn)){try{return fn.call(self,arg);}catch(error){if(opts.alert){alert("Error calling scrollable."+name+": "+error);}else{throw error;}return false;}}return true;}var current=null;function Scrollable(root,conf){var self=this;if(!current){current=self;}var horizontal=!conf.vertical;var wrap=$(conf.items,root);var index=0;var navi=root.siblings(conf.navi).eq(0);var prev=root.siblings(conf.prev).eq(0);var next=root.siblings(conf.next).eq(0);var prevPage=root.siblings(conf.prevPage).eq(0);var nextPage=root.siblings(conf.nextPage).eq(0);$.extend(self,{getVersion:function(){return[1,0,1];},getIndex:function(){return index;},getConf:function(){return conf;},getSize:function(){return self.getItems().size();},getPageAmount:function(){return Math.ceil(this.getSize()/conf.size);},getPageIndex:function(){return Math.ceil(index/conf.size);},getRoot:function(){return root;},getItemWrap:function(){return wrap;},getItems:function(){return wrap.children();},seekTo:function(i,time,fn){time=time||conf.speed;if($.isFunction(time)){fn=time;time=conf.speed;}if(i<0){i=0;}if(i>self.getSize()-conf.size){return self;}var item=self.getItems().eq(i);if(!item.length){return self;}if(fireEvent(conf,"onBeforeSeek",self,i)===false){return self;}if(horizontal){var left=-(item.outerWidth(true)*i);wrap.animate({left:left},time,conf.easing,fn?function(){fn.call(self);}:null);}else{var top=-(item.outerHeight(true)*i);wrap.animate({top:top},time,conf.easing,fn?function(){fn.call(self);}:null);}if(navi.length){var klass=conf.activeClass;var page=Math.ceil(i/conf.size);page=Math.min(page,navi.children().length-1);navi.children().removeClass(klass).eq(page).addClass(klass);}if(i===0){prev.add(prevPage).addClass(conf.disabledClass);}else{prev.add(prevPage).removeClass(conf.disabledClass);}if(i>=self.getSize()-conf.size){next.add(nextPage).addClass(conf.disabledClass);}else{next.add(nextPage).removeClass(conf.disabledClass);}current=self;index=i;fireEvent(conf,"onSeek",self,i);return self;},move:function(offset,time,fn){var to=index+offset;if(conf.loop&&to>(self.getSize()-conf.size)){to=0;}return this.seekTo(to,time,fn);},next:function(time,fn){return this.move(1,time,fn);},prev:function(time,fn){return this.move(-1,time,fn);},movePage:function(offset,time,fn){return this.move(conf.size*offset,time,fn);},setPage:function(page,time,fn){var size=conf.size;var index=size*page;var lastPage=index+size>=this.getSize();if(lastPage){index=this.getSize()-conf.size;}return this.seekTo(index,time,fn);},prevPage:function(time,fn){return this.setPage(this.getPageIndex()-1,time,fn);},nextPage:function(time,fn){return this.setPage(this.getPageIndex()+1,time,fn);},begin:function(time,fn){return this.seekTo(0,time,fn);},end:function(time,fn){return this.seekTo(this.getSize()-conf.size,time,fn);},reload:function(){return load();},click:function(index,time,fn){var item=self.getItems().eq(index);var klass=conf.activeClass;if(!item.hasClass(klass)&&(index>=0||index<this.getSize())){self.getItems().removeClass(klass);item.addClass(klass);var delta=Math.floor(conf.size/2);var to=index-delta;if(to>self.getSize()-conf.size){to--;}if(to!==index){return this.seekTo(to,time,fn);}}return self;}});if($.isFunction($.fn.mousewheel)){root.bind("mousewheel.scrollable",function(e,delta){var step=$.browser.opera?1:-1;self.move(delta>0?step:-step,50);return false;});}prev.addClass(conf.disabledClass).click(function(){self.prev();});next.click(function(){self.next();});nextPage.click(function(){self.nextPage();});prevPage.addClass(conf.disabledClass).click(function(){self.prevPage();});if(conf.keyboard){$(window).unbind("keypress.scrollable").bind("keypress.scrollable",function(evt){var el=current;if(!el){return;}if(horizontal&&(evt.keyCode==37||evt.keyCode==39)){el.move(evt.keyCode==37?-1:1);return evt.preventDefault();}if(!horizontal&&(evt.keyCode==38||evt.keyCode==40)){el.move(evt.keyCode==38?-1:1);return evt.preventDefault();}return true;});}function load(){navi.each(function(){var nav=$(this);if(nav.is(":empty")||nav.data("me")==self){nav.empty();nav.data("me",self);for(var i=0;i<self.getPageAmount();i++){var item=$("<"+conf.naviItem+"/>").attr("href",i).click(function(e){var el=$(this);el.parent().children().removeClass(conf.activeClass);el.addClass(conf.activeClass);self.setPage(el.attr("href"));return e.preventDefault();});if(i===0){item.addClass(conf.activeClass);}nav.append(item);}}else{var els=nav.children();els.each(function(i){var item=$(this);item.attr("href",i);if(i===0){item.addClass(conf.activeClass);}item.click(function(){nav.find("."+conf.activeClass).removeClass(conf.activeClass);item.addClass(conf.activeClass);self.setPage(item.attr("href"));});});}});if(conf.clickable){self.getItems().each(function(index,arg){var el=$(this);if(!el.data("set")){el.bind("click.scrollable",function(){self.click(index);});el.data("set",true);}});}if(conf.hoverClass){self.getItems().hover(function(){$(this).addClass(conf.hoverClass);},function(){$(this).removeClass(conf.hoverClass);});}return self;}load();var timer=null;function setTimer(){timer=setInterval(function(){self.next();},conf.interval);}if(conf.interval>0){root.hover(function(){clearInterval(timer);},function(){setTimer();});setTimer();}}jQuery.prototype.scrollable=function(conf){var api=this.eq(typeof conf=='number'?conf:0).data("scrollable");if(api){return api;}var opts={size:5,vertical:false,clickable:true,loop:false,interval:0,speed:400,keyboard:true,activeClass:'active',disabledClass:'disabled',hoverClass:null,easing:'swing',items:'.items',prev:'.prev',next:'.next',prevPage:'.prevPage',nextPage:'.nextPage',navi:'.navi',naviItem:'a',onBeforeSeek:null,onSeek:null,alert:true};$.extend(opts,conf);this.each(function(){var el=new Scrollable($(this),opts);$(this).data("scrollable",el);});return this;};})(jQuery);
/*validate*/(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){validator.settings.submitHandler.call(validator,validator.currentForm);return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=false;var validator=$(this[0].form).validate();this.each(function(){valid|=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(a.value);},filled:function(a){return!!$.trim(a.value);},unchecked:function(a){return!a.checked;}});$.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);},highlight:function(element,errorClass){$(element).addClass(errorClass);},unhighlight:function(element,errorClass){$(element).removeClass(errorClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.format("Please enter no more than {0} characters."),minlength:$.format("Please enter at least {0} characters."),rangelength:$.format("Please enter a value between {0} and {1} characters long."),range:$.format("Please enter a value between {0} and {1}."),max:$.format("Please enter a value less than or equal to {0}."),min:$.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.formSubmitted=false;this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id+", check the '"+rule.method+"' method");throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method);if(typeof message=="function")message=message.call(this,rule.parameters,element);this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parents(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){return this.errors().filter("[for='"+this.idOrName(element)+"']");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message;if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var options=$("option:selected",element);return options.length>0&&(element.type=="select-multiple"||($.browser.msie&&!(options[0].attributes['value'].specified)?options[0].text:options[0].value).length>0);case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){if(response){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};errors[element.name]=response||validator.defaultMessage(element,"remote");validator.showErrors(errors);}previous.valid=response;validator.stopRequest(element,response);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},dateDE:function(value,element){return this.optional(element)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},numberDE:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param:"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){return value==$(param).val();}}});})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);
/*modalwindow*/(function($){$.fn.modalWindow=function(options){var params=$.extend({},$.fn.modalWindow.defaults,options);return this.each(function(){if(this._mW)return;if(typeof(mW_count)=='undefined'){mW_count=0;}mW_count++;this._mW=mW_count;hash[mW_count]={config:params,target_mW:this};$(this).modalWindow_add(this);});};$.fn.modalWindow_add=function(elm){return $.modalWindow._open(elm);};$.fn.modalWindow_show=function(){return this.each(function(){$.modalWindow._open(this);});};$.fn.modalWindow_hide=function(){return this.each(function(){$.modalWindow.hide(this,true);});};$.fn.modalWindow.defaults={show:false,hide:false,content:'',modalStyles:{display:"block",zIndex:2000},draggable:false,resizeable:true,transparency:50,overlayClass:'modalOverlay',windowClass:'modalWindow',titleClass:'modalTitle',closeClass:'modalClose',selector:'.modal',mode:'strict',textClose:'close'};$.modalWindow={hash:{},show:function(elm){var h=hash[elm._mW];jQ(h.target_mW).click(function(){$.modalWindow._open(elm);return false;});return false;},hide:function(elm,bool){var h=hash[elm._mW];if(h.config.mode!='strict'){var idstr='div.'+h.config.overlayClass+',div.'+h.config.closeClass;}else{var idstr='div.'+h.config.closeClass;}if(bool){$.modalWindow._close(elm);}jQ(idstr).click(function(){$.modalWindow._close(elm);return false;});},_open:function(elm){var h=hash[elm._mW];$.modalWindow._overlay(elm);$.modalWindow._container(elm);jQ('div.'+h.config.windowClass).html($.modalWindow._content(elm,$(h.target_mW)));if(h.config.modalStyles){jQ('div.'+h.config.windowClass).css(h.config.modalStyles);}if(h.config.resizeable){$.modalWindow._resize(elm);}$.modalWindow._fixie(jQ('div.'+h.config.overlayClass));if(h.config.show){h.config.show(elm);}$.modalWindow.hide(elm);return false;},_close:function(elm){var h=hash[elm._mW];jQ('div.'+h.config.windowClass).remove();jQ('div.'+h.config.overlayClass).remove();if(h.config.hide){h.config.hide(elm);}return false;},_resize:function(elm){var max_width=0,max_height=0,h=hash[elm._mW];jQ('div.'+h.config.windowClass+' *').load(function(){jQ('div.'+h.config.windowClass+' *').each(function(){var twidth=jQ(this).outerWidth(),theight=jQ(this).outerHeight();if(twidth>max_width){max_width=twidth;}max_height+=theight;});if(max_width>0&&max_height>0){jQ('div.'+h.config.windowClass).css('width',(max_width+jQ('div.'+h.config.windowClass+' .'+h.config.closeClass+':first').outerWidth())+'px').css('height',(max_height)+'px').css('margin-left','-'+(max_width/2)+'px');}});return false;},_overlay:function(elm){var h=hash[elm._mW];if(!jQ('div.'+h.config.overlayClass).length){jQ('<div />').addClass(h.config.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,zIndex:2000,opacity:h.config.transparency/100}).appendTo('body')}return false;},_container:function(elm){var h=hash[elm._mW];if(!jQ('div.'+h.config.windowClass).length){jQ('<div />').addClass(h.config.windowClass).appendTo('body');}return false;},_content:function(elm,trigger){var h=hash[elm._mW];var con='<div class="'+h.config.closeClass+'">'+h.config.textClose+'</div>';if(trigger.attr('rel')){divId=jQ('#'+trigger.attr('rel'));divClass=jQ('.'+trigger.attr('rel'));if(divId.length){con+=divId.html();}else if(divClass.length){con+=divClass.html();}}else if(trigger.attr('src')){if(trigger.attr('title')){con+='<h3 class="fixfloat '+h.config.titleClass+'">'+trigger.attr('title')+'</h3>';}else{con+='<h3 class="fixfloat '+h.config.titleClass+'">'+trigger.attr('src')+'</h3>';}}else{con+=trigger.html();}return con;},_fixie:function(obj){if(ie6&&$('html,body').css({height:'100%',width:'100%'})&&obj){$('html,body').css({height:'100%',width:'100%'});iframe=$('<iframe src="javascript:false;document.write(\'\');" class="overlay"></iframe>').css({opacity:0});obj.html('<p style="width:100%;height:100%"/>').prepend(iframe);obj=obj.css({position:'absolute'})[0];}return false;}};var hash=$.modalWindow.hash;var jQ=jQuery;var ie6=$.browser.msie&&($.browser.version=='6.0');})(jQuery);
/*suggest*/(function($){

	$.fn.suggest = function(searchData, settings) {
		var defaults = {
			minCharacters: 1,
			maxResults: undefined,
			wildCard: "",
			caseSensitive: false,
			notCharacter: "!",
			maxHeight: 350,
			highlightMatches: true,
			onSelect: undefined,
			ajaxResults: false
			};
		settings = $.extend(defaults, settings);

		return this.each(function() {

			function regexEscape(txt, omit) {
				var specials = ['/', '.', '*', '+', '?', '|',
								'(', ')', '[', ']', '{', '}', '\\'];

				if (omit) {
					for (var i=0; i < specials.length; i++) {
						if (specials[i] === omit) { specials.splice(i,1); }
					}
				}

				var escapePatt = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
				return txt.replace(escapePatt, '\\$1');
			}

			var obj = $(this),
				wildCardPatt = new RegExp(regexEscape(settings.wildCard || ''),'g'),
				results = $('<ul />'),
				currentSelection, pageX, pageY;

			// When an item has been selected then update the input box,
			// hide the results again and if set, call the onSelect function
			function selectResultItem(item) {
				obj.val(item.text);
				$(results).html('').hide();

				if (typeof settings.onSelect === 'function') {
					settings.onSelect(item);
				}
			}

			// Used to get rid of the hover class on all result item elements in the
			// current set of results and add it only to the given element. We also
			// need to set the current selection to the given element here.
			function setHoverClass(el) {
				$('li.resultItem', results).removeClass('hover');
				$(el).addClass('hover');

				currentSelection = el;
			}

			// Build the results HTML based on an array of objects that matched
			// the search criteria, highlight the matches if feature is turned on in
			// the settings.
			function buildResults(resultObjects, sFilterTxt) {
				sFilterTxt = "(" + sFilterTxt + ")";

				var bOddRow = true, i, iFound = 0,
					filterPatt = settings.caseSensitive ? new RegExp(sFilterTxt, "g") : new RegExp(sFilterTxt, "ig");

				$(results).html('').hide();

				for (i = 0; i < resultObjects.length; i += 1) {
					var item = $('<li />'),
						text = resultObjects[i].productsname;

					if (settings.highlightMatches === true) {
						text = text.replace(filterPatt, "<strong>$1</strong>");
					}

					$(item).append('<a href="'+resultObjects[i].productsurl+'">'+text+'</a>');
					if (typeof resultObjects[i].category === 'string') {
						$(item).append('<br />'+resultObjects[i].category);
					}

					if(typeof resultObjects[i].productsimage==='string'){
						$(item).prepend('<span class="miniProductsImage">'+resultObjects[i].productsimage+'<a href="'+resultObjects[i].productsurl+'" rel="'+resultObjects[i].productsid+'|N" class="zoomicon"></a></span>');
					}

					$(item).addClass('resultItem').
						addClass((bOddRow) ? 'odd' : 'even').
						click(function(n) { return function() {
							selectResultItem(resultObjects[n]);
						};}(i)).
						mouseover(function(el) { return function() {
							setHoverClass(el);
						};}(item));
					$(results).append(item);

					bOddRow = !bOddRow;

					iFound += 1;
					if (typeof settings.maxResults === 'number' && iFound >= settings.maxResults) {
						break;
					}
				}

				if ($('li', results).length > 0) {
					currentSelection = undefined;
					$(results).show().css('height', 'auto');

					if ($(results).height() > settings.maxHeight) {
						$(results).css({'overflow': 'auto', 'height': settings.maxHeight + 'px'});
					}
				}
			}

			// Prepare the search string based on the settings for this plugin,
			// run it against each item in the searchData and display any
			// results on the page allowing selection by the user.
			function runSuggest(e) {
				if (this.value.length < settings.minCharacters) {
					$(results).html('').hide();
					return false;
				}

				var resultObjects = [],
					sFilterTxt = (!settings.wildCard) ? regexEscape(this.value) : regexEscape(this.value, settings.wildCard).replace(wildCardPatt, '.*'),
					bMatch = true,
					filterPatt, i;

				if (settings.notCharacter && sFilterTxt.indexOf(settings.notCharacter) === 0) {
					sFilterTxt = sFilterTxt.substr(settings.notCharacter.length,sFilterTxt.length);
					if (sFilterTxt.length > 0) { bMatch = false; }
				}
				sFilterTxt = sFilterTxt || '.*';
				sFilterTxt = settings.wildCard ? '^' + sFilterTxt : sFilterTxt;
				filterPatt = settings.caseSensitive ? new RegExp(sFilterTxt) : new RegExp(sFilterTxt,"i");

				// Get the results from the correct place. If settings.ajaxResults then results are retrieved from
				// an external function each time they are needed else they are retrieved from the data
				// given on contruction.
				if (settings.ajaxResults === true) {
					resultObjects = searchData(this.value, 	settings.wildCard,
															settings.caseSensitive,
															settings.notCharacter);

					if (typeof resultObjects === 'string') {
						resultObjects = jsonParse(resultObjects);
					}
				}
				else {
					// Look for the required match against each single search data item. When the not
					// character is used we are looking for a false match.
					for (i = 0; i < searchData.length; i += 1) {
						if (filterPatt.test(searchData[i].text) === bMatch) {
							resultObjects.push(searchData[i]);
						}
					}
				}

				buildResults(resultObjects, sFilterTxt);
			}

			// To call specific actions based on the keys pressed in the input
			// box. Special keys are up, down and return. All other keys
			// act as normal.
			function keyListener(e) {
				switch (e.keyCode) {
					case 9: // tab key
					case 13: // return key
						$(currentSelection).trigger('click');

						return false;
					case 27: // esc key
						$(results).hide();
						return false;
					case 40: // down key
						if (typeof currentSelection === 'undefined') {
							currentSelection = $('li.resultItem:first', results).get(0);
						}
						else {
							currentSelection = $(currentSelection).next().get(0);
						}

						setHoverClass(currentSelection);
						if (currentSelection) {
							$(results).scrollTop(currentSelection.offsetTop);
						}

						return false;
					case 38: // up key
						if (typeof currentSelection === 'undefined') {
							currentSelection = $('li.resultItem:last', results).get(0);
						}
						else {
							currentSelection = $(currentSelection).prev().get(0);
						}

						setHoverClass(currentSelection);
						if (currentSelection) {
							$(results).scrollTop(currentSelection.offsetTop);
						}

						return false;
					default:
						runSuggest.apply(this, [e]);
				}
			}

			// Prepare the input box to show suggest results by adding in the events
			// that will initiate the search and placing the element on the page
			// that will show the results.
			$(results).addClass('suggestResults').
				css({
					'top': (obj.position().top + obj.height() + 5) + 'px',
					'left': obj.position().left + 'px',
					'width': obj.width() + 'px'
				}).hide();

			obj.after(results).
				keyup(keyListener).
				blur(function(e) {
					// We need to make sure we don't hide the result set
					// if the input blur event is called because of clicking on
					// a result item.
					var resPos = $(results).offset();
					resPos.bottom = resPos.top + $(results).height();
					resPos.right = resPos.left + $(results).width();

					if (pageY < resPos.top || pageY > resPos.bottom || pageX < resPos.left || pageX > resPos.right) {
						$(results).hide();
					}
				}).
				focus(function(e) {
					if ($('li', results).length > 0) {
						$(results).show();
					}
				}).
				attr('autocomplete', 'off');
			$().mousemove(function(e) {
				pageX = e.pageX;
				pageY = e.pageY;
			});

			// Opera doesn't seem to assign a keyCode for the down
			// key on the keyup event. why?
			if ($.browser.opera) {
				obj.keydown(function(e) {
					if (e.keyCode === 40) { // up key
						return keyListener(e);
					}
				});
			}

			// Escape the not character if present so that it doesn't act in the regular expression
			settings.notCharacter = regexEscape(settings.notCharacter || '');

			// We need to get the javascript array type data from the searchData setting.
			// Setting can either be a string, already an array or a function that returns one
			// of those things. We only get this data if it isn't being provided using ajax on
			// each search
			if (!settings.ajaxResults) {
				if (typeof searchData === 'function') {
					searchData = searchData();
				}
				if (typeof searchData === 'string') {
					//searchData = JSON.parse(searchData);
					//searchData = jsonParse(searchData);
					searchData = searchData;
				}
			}
		});
	};
})(jQuery);
/*firebuglog*/(function($){$.fn.log=function(logmsg){console.log("%s:%o",logmsg,this);return this;}})(jQuery);
/* tabacc */
(function($){
	$.fn.tabacc = function(options){
		var defaults = {};
		var settings = $.extend(defaults,options);
		return this.each(function(){
			var obj			= $(this);
			var tabnav		= obj.children('.tab-nav');
			var tabcontent	= obj.children('.tab-row');
			tabnav.children('li:first').addClass('active');
			tabnav.children('li').each(function(i){
				$(this).children('a').click(function(e){
					tabnav.children('li').removeClass('active');
					$(this).parent().toggleClass('active');
					tabcontent.hide();
					tabcontent.eq(i).show();
					e.preventDefault();
				});
			});
			tabcontent.css('clear','both');
			tabcontent.find('h2').hide();
			tabcontent.hide();
			tabcontent.eq(0).show();
			tabcontent.each(function(i){
				$(this).find('h4').each(function(j){
					if($(this).next().html()!='&nbsp;'){
						$(this).css({'cursor':'pointer'});
					}
					$(this).next().hide();
					$(this).click(function(e){
						if($(this).next().html()!='&nbsp;'){
							$(this).next().toggle();
						}
					});
				});
			});
		});
	};
})(jQuery);
/* /tabacc */
/***custom functions***/
$(document).ready(function(){
	$('div#tabs').tabacc();
	/*quicksearch*/
	$('input#quicksearchvalue').live('keydown',function(){$(this).doTimeout('quicksearch');}).live('keyup',function(){$(this).doTimeout('quicksearch',500,function(){quicksearch($('input#quicksearchvalue').val())});});
	function quicksearch(search){
		if(search.length>2){
			//$.ajax({type:'GET',url:'advanced_search.php',data:'mode=quick&q='+search,dataType:'json',success:function(jsonObj){console.log(jsonObj);$('input#quicksearchvalue').suggest(jsonObj,{maxResults:10,minCharacters:3});}});
			//$.get("advanced_search.php",{mode:'quick',q:search},function(data){$('input#quicksearchvalue').suggest(data,{maxResults:10,minCharacters:3});});
			//$.getJSON("advanced_search.php?mode=quick&q="+search,function(json){$('input#quicksearchvalue').suggest(json,{maxResults:10,minCharacters:3,ajaxResults:true});});
		}
		$('input#quicksearchvalue').suggest(
			function(search, wildCard, caseSensitive, notCharacter){
				// From here you can put your own logic in to say what results show.
				// For now I'm just going to return some dummy data.
				/*return [
					{text:'View'},
					{text:'the'},
					{text:'source'},
					{text:'for'},
					{text:'this'},
					{text:'one'}
				];*/
				$.getJSON("advanced_search.php?mode=quick&q="+search,function(json){return json;});
			},
			{ajaxResults:true,maxResults:10,minCharacters:3}
		);
	}
	/*tabbed content*/
	$('.tabwrapper').each(function(i){
		$(this).children('.tabwrap:eq('+i+') .tabcontent:gt(0)').hide();
		$(this).children('.tabbednav:eq('+i+') li:first').addClass('active');
		var items=$(this).children('.tabbednav:eq('+i+') a');
		items.each(function(j){
			$(this).hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});
			$(this).click(function(e){
				if(e.button==2)return;
				$(this).parents('.tabbednav:eq('+i+') .active').toggleClass('active');
				$(this).toggleClass('active');
				$(this).parent().toggleClass('active');
				var tab=$(this).attr('href').split('#');
				$(this).parents('.tabwrapper:eq('+i+') .tabcontent').hide();
				$('#'+tab[1]).show();
				e.preventDefault();
			});
		});
	});
	/* basket/wishlist */
	$('li[id="tab_basket"],li[id="tab_wishlist"]').live('click', function(e){
		var id;
		switch ($(this).attr('id')) {
			case 'tab_basket':
				id = 1;
				$('li[id="tab_wishlist"]').removeClass('active');
				$('li[id="tab_basket"]').addClass('active');
				$('div#basket').removeClass('none');
				$('div#wishlist').addClass('none');
			break;
			case 'tab_wishlist':
				id = 2;
				$('li[id="tab_basket"]').removeClass('active');
				$('li[id="tab_wishlist"]').addClass('active');
				$('div#wishlist').removeClass('none');
				$('div#basket').addClass('none');
			break;
		}
		//{type:'GET',url:'advanced_search.php',data:'mode=quick&q='+search}
		$.ajax({type:'GET',url:'index.php',data:'mode=ajax&switch='+id+'&action=switch_wish_cart'});
		e.preventDefault();
	});
	/* productbrowser */
	$('div.productbrowser').css({overflow:'hidden',height:'210px'});
	var productbrowser=$('div.productbrowser').scrollable({api:true,size:1,loop:false});
	/* smallgallery */
	var smallgallery = $('div#gallery').scrollable({api:true,size:3,hoverClass:'hover',loop:false});
	smallgallery.css({overflow:'hidden'});
	$('a.prev').live('click',function(e){smallgallery.prev();});
	$('a.next').live('click',function(e){smallgallery.next();});
	smallgallery.children('*').children().each(function(i){
		$(this).mouseover(function(){
			$('div#galleryViewImage div.imageZoom img').remove();
			$('div#imagepreloader img[rel="med'+i+'"]').clone().prependTo($('div#galleryViewImage div.imageZoom'));
		}).click(function(){showLargeImage(i,false);});
	});
	/* product popup */
	function productpopup(rel,e){
		var pid=rel.split('|'),opener=document.location.href,mposX=e.pageX,mposY=e.pageY,cw=$('#content').width(),ch=$('#content').height(),coff=$('#content').offset(),cposX=coff.left,cposY=coff.top,posX=parseInt(mposX-cposX),posY=parseInt(mposY-cposY);
		if(posX>parseInt(cw-cposX)){posX=parseInt(posX-600);}
		if($('div#product_info_popup').length>0){$('div#product_info_popup').remove();}
		$('<div id="product_info_popup"></div>').appendTo('#page').css({position:'absolute',top:posY+'px',left:posX+'px'}).show('slow').animate({width:600}, 'slow');
		$.ajax({type:'GET',url:'store-products-image-popup.php',cache:false,data:'products_id='+pid[0]+'&type='+pid[1]+'&opener='+escape(opener),success:function(html){$('#product_info_popup').html(html);}});
	}
	$('body').live('click',function(e){
		var resPos=$('#product_info_popup').offset();
		resPos.bottom=resPos.top+$('#product_info_popup').height();
		resPos.right=resPos.left+$('#product_info_popup').width();
		if(e.pageY<resPos.top||e.pageY>resPos.bottom||e.pageX<resPos.left||e.pageX>resPos.right){$('#product_info_popup').remove();}
	});
	$('span.zoomclose').live('click',function(e){$('#product_info_popup').remove();});
	$('a.zoomicon,#next_previous a').live('mouseover',function(e){
		$(this).doTimeout('productpopup',500,function(){productpopup($(this).attr('rel'),e)});
	}).live('mouseout',function(e){
		$(this).doTimeout('productpopup');
	});
	$('textarea').live('click',function(){
		if($(this).hasClass('selectable')){
			$(this).select();
		}
	});
});
/* expose */
(function($) {

	// static constructs
	$.tools = $.tools || {version: {}};

	$.tools.version.expose = '1.0.3';

	function getWidth() {

		var w = $(window).width();

		if ($.browser.mozilla) { return w; }

		var x;

		if (window.innerHeight && window.scrollMaxY) {
			x = window.innerWidth + window.scrollMaxX;

		// all but Explorer Mac
		} else if (document.body.scrollHeight > document.body.offsetHeight) {
			x = document.body.scrollWidth;

		} else {
			x = document.body.offsetWidth;
		}

		return x < w ? x + 20 : w;
	}

	function Expose(els, opts) {

		// private variables
		var self = this, mask = null, loaded = false, origIndex = 0;

		// generic binding function
		function bind(name, fn) {
			$(self).bind(name, function(e, args) {
				if (fn && fn.call(this) === false && args) {
					args.proceed = false;
				}
			});
			return self;
		}

		// bind all callbacks from configuration
		$.each(opts, function(name, fn) {
			if ($.isFunction(fn)) { bind(name, fn); }
		});


		// adjust mask size when window is resized (or firebug is toggled)
		$(window).bind("resize.expose", function() {
			if (mask) {
				mask.css({ width: getWidth(), height: $(document).height()});
			}
		});


		// public methods
		$.extend(this, {

			getMask: function() {
				return mask;
			},

			getExposed: function() {
				return els;
			},

			getConf: function() {
				return opts;
			},

			isLoaded: function() {
				return loaded;
			},

			load: function() {

				// already loaded ?
				if (loaded) { return self;	}

				origIndex = els.eq(0).css("zIndex");

				// find existing mask
				if (opts.maskId) { mask = $("#" + opts.maskId);	}

				if (!mask || !mask.length) {

					mask = $('<div/>').css({
						position:'absolute',
						top:0,
						left:0,
						width: getWidth(),
						height: $(document).height(),
						display:'none',
						opacity: 0,
						zIndex:opts.zIndex
					});

					// id
					if (opts.maskId) { mask.attr("id", opts.maskId); }

					$("body").append(mask);


					// background color
					var bg = mask.css("backgroundColor");

					if (!bg || bg == 'transparent' || bg == 'rgba(0, 0, 0, 0)') {
						mask.css("backgroundColor", opts.color);
					}

					// esc button
					if (opts.closeOnEsc) {
						$(document).bind("keydown.unexpose", function(evt) {
							if (evt.keyCode == 27) {
								self.close();
							}
						});
					}

					// mask click closes
					if (opts.closeOnClick) {
						mask.bind("click.unexpose", function()  {
							self.close();
						});
					}
				}

				// possibility to cancel click action
				var p = {proceed: true};
				$(self).trigger("onBeforeLoad", p);
				if (!p.proceed) { return self; }


				// make sure element is positioned absolutely or relatively
				$.each(els, function() {
					var el = $(this);
					if (!/relative|absolute|fixed/i.test(el.css("position"))) {
						el.css("position", "relative");
					}
				});

				// make elements sit on top of the mask
				els.css({zIndex:opts.zIndex + 1});


				// reveal mask
				var h = mask.height();

				if (!this.isLoaded()) {
					mask.css({opacity: 0, display: 'block'}).fadeTo(opts.loadSpeed, opts.opacity, function() {

						// sometimes IE6 misses the height property on fadeTo method
						if (mask.height() != h) { mask.css("height", h); }
						$(self).trigger("onLoad");
					});
				}

				loaded = true;
				return self;
			},


			close: function() {

				if (!loaded) { return self; }

				var p = {proceed: true};
				$(self).trigger("onBeforeClose", p);
				if (p.proceed === false) { return self; }

				mask.fadeOut(opts.closeSpeed, function() {
					$(self).trigger("onClose");
					els.css({zIndex: $.browser.msie ? origIndex : null});
				});

				loaded = false;
				return self;
			},


			onBeforeLoad: function(fn) {
				return bind("onBeforeLoad", fn);
			},

			onLoad: function(fn) {
				return bind("onLoad", fn);
			},

			onBeforeClose: function(fn) {
				return bind("onBeforeClose", fn);
			},

			onClose: function(fn) {
				return bind("onClose", fn);
			}

		});

	}


	// jQuery plugin implementation
	$.fn.expose = function(conf) {

		var el = this.eq(typeof conf == 'number' ? conf : 0).data("expose");
		if (el) { return el; }

		var opts = {
			/*
			 - onBeforeLoad
			 - onLoad
			 - onBeforeClose
			 - onClose
			*/

			// mask settings
			maskId: null,
			loadSpeed: 'slow',
			closeSpeed: 'fast',
			closeOnClick: true,
			closeOnEsc: true,

			// css settings
			zIndex: 9998,
			opacity: 0.8,
			color: '#456',
			api: false
		};

		if (typeof conf == 'string') {
			conf = {color: conf};
		}

		$.extend(opts, conf);

		// construct exposes
		this.each(function() {
			el = new Expose($(this), opts);
			$(this).data("expose", el);
		});

		return opts.api ? el: this;
	};


})(jQuery);
function hideie6nomore(){
	$.cookie('ie6nomore','false');
	$('#ie6nomore').remove();
	return false;
}
/* Productinfoimage */
function showMediumImage(imgnr) {
	$('div#imagepreloader img[rel="'+imgnr+'"]').clone().prependTo($('div#galleryViewImage div.imageZoom'));
}
function showLargeImages(imgdata,imgnr) {
	$('div#imagepreloader').append(imgdata);
	$('div#imagepreloader img[id="spinner"]').clone().prependTo($('div#productImageZoomContent div.imageZoom'));
	if($.browser.msie&&($.browser.version==6||$.browser.version==7)){
		$('div#productImageZoom').show(0);
		$('div#galleryViewImage').hide(0);
	}else{
		$('div#productImageZoom').show('slow');
		$('div#galleryViewImage').fadeTo('slow', 0).hide('slow');
	}
	showLargeImage(imgnr);
}
function showLargeImage(imgnr,zoom) {
	$('div#productImageZoomContent div.imageZoom img').remove();
	$('div#imagepreloader img[rel="lrg'+imgnr+'"]').clone().prependTo($('div#productImageZoomContent div.imageZoom'));
	$('div#productImageZoomContent div.imageZoom img').css({width:'90%',height:'auto'});
	if (zoom==true) {
		if($.browser.msie&&($.browser.version==6||$.browser.version==7)){
			$('div#productImageZoom').show(0);
			$('div#galleryViewImage').hide(0);
		}else{
			$('div#productImageZoom').show('slow');
			$('div#galleryViewImage').fadeTo('slow', 0).hide('slow');
		}
	}
	var pimg=parseInt(imgnr)-1,nimg=parseInt(imgnr)+1,len=$('div#imagepreloader img[rel^="lrg"]').length;
	if (len <= 1) {
		$('div#productImageZoomBar>span#zoomprev').addClass('false');
		$('div#productImageZoomBar>span#zoomnext').addClass('false');
	} else {
		$('div#productImageZoomBar>span#zoomprev').removeClass('false');
		$('div#productImageZoomBar>span#zoomnext').removeClass('false');
		if (nimg==len) {
			$('div#productImageZoomBar>span#zoomnext').addClass('false');
		} else {
			$('div#productImageZoomBar>span#zoomnext').removeClass('false');
		}
		if (pimg>-1) {
			$('div#productImageZoomBar>span#zoomprev').removeClass('false');
		} else {
			$('div#productImageZoomBar>span#zoomprev').addClass('false');
		}
	}
}
function showPopupImages(imgdata,imgnr) {
	var gallery = ($('div#gallery').html()!=null?$('div#gallery').html():'');
	$('div#imagepreloader').append(imgdata);
	$('div#productImagePopup img').remove();
	$('<div id="productImagePopup"><span class="zoomclose"></span><h1>'+$('div#imagepreloader img[rel="pop'+imgnr+'"]').attr('title')+'</h1><div id="popupImageGallery">'+gallery+'</div><div id="popupImage"></div></div>').prependTo('body');
	$('div#popupImage').html($('#imagepreloader img[rel="pop'+imgnr+'"]').clone());
	$('div#popupImageGallery img:not('+imgnr+')').removeClass('active');
	$('div#popupImageGallery img:eq('+imgnr+')').addClass('active');
	exposelayer('productImagePopup',false);
}
function showPopupImage(imgnr) {
	$('div#productImagePopup div#popupImage img').replaceWith($('div#imagepreloader img[rel="pop'+imgnr+'"]').clone());
	$('div#popupImageGallery img:not('+imgnr+')').removeClass('active');
	$('div#popupImageGallery img:eq('+imgnr+')').addClass('active');
	exposelayer('productImagePopup',true);
}
function exposelayer(id,show) {
	var ww = parseInt(window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : 740);
	var wh = parseInt(window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : 400);
	var	pw=ww-120,ph=wh-60,iw=pw-150,ih=ph-50;
	$('div#popupImage img').css({height:ih+'px',width:'auto'});
	var popup=$('#'+id).expose({api:true,color:'#232323',maskId:'mask'});
	if (show!=true) {
		popup.onBeforeLoad(function(){
			if($.browser.msie&&$.browser.version==7){
				this.getExposed().css({position:'fixed',top:'20px',left:'50%',marginLeft:'-'+(pw/2),width:pw+'px',height:ph+'px',opacity:'1'});
			}else{
				this.getExposed().css({position:'fixed',marginLeft:50+'px',marginTop:20+'px',width:pw+'px',height:ph+'px',opacity:'1'});
			}
		});
	} else if (show==true) {
		popup.onBeforeLoad(function(){
			this.getExposed().show();
		});
	}
	popup.onBeforeClose(function(){
		this.getExposed().hide();
	});
	popup.load();
}
$('div#productImagePopup span.zoomclose').live('click',function(e){var popup=$('div#productImagePopup').expose(0);popup.close();});
$('div#popupImageGallery img').live('click',function(e){showPopupImage($(this).attr('rel').substr(3));}).live('mouseover',function(e){$(this).addClass('hover');}).live('mouseout',function(e){$(this).removeClass('hover');});

/* Gallery Slideshow */
$(document).ready(function(){
	function getProductsId() {
		return $(':input[id="galleryproductsid"]').val();
	}
	$('div.imageZoom').hover(function(){$('div.imageZoom>span.zoom').show(0)},function(){$('div.imageZoom>span.zoom').hide(0)});
	$('div#galleryViewImage div.imageZoom img[rel^="med"]').live('click', function(e) {
		if (e.button == 2) return;
		var medimg = $(this).attr('rel').substr(3);
		if ($('div#imagepreloader img[rel^="lrg"]').length<1) {
			$.get("store-products.php",{action:"loadimages",size:"large",products_id:getProductsId()},function(html){showLargeImages(html,medimg);},"html");
		} else {
			showLargeImage(medimg,true);
		}
		var img=parseInt($('div#galleryViewImage div.imageZoom img[rel^="med"]').attr('rel').substr(3)),pimg=parseInt(img)-1,nimg=parseInt(img)+1,len=$('div#galleryViewImage div.imageZoom img[rel^="med"]').length;
		if (len <= 2) {
			$('div#productImageZoomBar span#zoomprev, div#productImageZoomBar span#zoomnext').addClass('false');
		} else if (pimg==-1) {
			$('div#productImageZoomBar span#zoomprev').addClass('false');
		} else if (nimg==len-1) {
			$('div#productImageZoomBar span#zoomnext').addClass('false');
		}
	});
	$('div#galleryViewImage div.imageZoom span.zoom').live('click', function(e) {
		if (e.button == 2) return;
		var medimg = $(this).parent('div').find('img').attr('rel').substr(3);
		if($('div#imagepreloader img[rel^="lrg"]').length<1){
			$.get("store-products.php",{action:"loadimages",size:"large",products_id:getProductsId()},function(html){showLargeImages(html,medimg);},"html");
		}else{
			showLargeImage(medimg,true);
		}
	});
	$('div#productImageZoom div.imageZoom img[rel^="lrg"]').live('click', function(e) {
		if (e.button==2||($.browser.msie&&$.browser.version==6)) return;
		var lrgimg = $(this).attr('rel').substr(3);
		if($('div#imagepreloader img[rel^="pop"]').length<1){
			$.get("store-products.php",{action:"loadimages",size:"popup",products_id:getProductsId()},function(html){showPopupImages(html,lrgimg);},"html");
		}else{
			showPopupImage(lrgimg,true);
		}
	});
	$('div#productImageZoom div.imageZoom span.zoom').live('click', function(e) {
		if (e.button==2||($.browser.msie&&$.browser.version==6)) return;
		var lrgimg = $(this).parents('div.imageZoom').find('img').attr('rel').substr(3);
		if($('div#imagepreloader img[rel^="pop"]').length<1){
			$.get("store-products.php",{action:"loadimages",size:"popup",products_id:getProductsId()},function(html){showPopupImages(html,lrgimg);},"html");
		}else{
			showPopupImage(lrgimg,true);
		}
	});
	$('div#productImageZoomBar>span#zoomprev').live('click', function(e) {
		if (e.button == 2) return;
		var img=parseInt($('div#productImageZoomContent>div.imageZoom>img[rel^="lrg"]').attr('rel').substr(3)),pimg=parseInt(img)-1,nimg=parseInt(img)+1,len=$('div#imagepreloader>img[rel^="lrg"]').length;
		if (pimg>-1&&pimg<img) {
			showLargeImage(pimg);
		}
		if (pimg<=0) {
			$('div#productImageZoomBar>span#zoomprev').addClass('false');
		}
		if (nimg<len) {
			$('div#productImageZoomBar>span#zoomnext').removeClass('false');
		}
		$('div#galleryImages div.galleryImage img:not([id^="min'+img+'"])').parent().removeClass('active');
		$('div#galleryImages div.galleryImage img[id^="min'+img+'"]').parent().addClass('active');
	});

	$('div#productImageZoomBar span#zoomnext').live('click', function(e) {
		if (e.button == 2) return;
		var img=parseInt($('div#productImageZoomContent div.imageZoom img[rel^="lrg"]').attr('rel').substr(3)),pimg=parseInt(img)-1,nimg=parseInt(img)+1,len=$('div#imagepreloader img[rel^="lrg"]').length;
		if (nimg<len&&nimg>img) {
			showLargeImage(nimg);
		}
		if (nimg==len-1) {
			$('div#productImageZoomBar>span#zoomnext').addClass('false');
		}
		if (pimg<img) {
			$('div#productImageZoomBar>span#zoomprev').removeClass('false');
		}
		$('div#galleryImages div.galleryImage img').not('div#galleryImages div.galleryImage img[id^="min'+img+'"]').parent().removeClass('active');
		$('div#galleryImages div.galleryImage img[id^="min'+img+'"]').parent().addClass('active');
	});
	$('div#productImageZoomBar span#zoomclose').click(function(e) {
		if (e.button == 2) return;
		if($.browser.msie&&($.browser.version==6||$.browser.version==7)){
			$('div#galleryViewImage').show(0)
			$('div#productImageZoom').hide(0);
		}else{
			$('div#galleryViewImage').show('slow').fadeTo('slow', 100);
			$('div#productImageZoom').hide('slow');
		}
		$('div#productImageZoomBar span#zoomprev, div#productImageZoomBar span#zoomnext').removeClass('false');
	});
	/* /Gallery Slideshow */
	/* /productinfoimage */
});
// Captcha
$('#captcha_reloadbutton').live('click', function(e) {
	var code = '';
	var tmp = 0;
	for (i=0;i<32;i++) {
		tmp = Math.round(Math.random() * 15);
		switch (tmp) {
			case 10: code = code + 'a'; break;
			case 11: code = code + 'b'; break;
			case 12: code = code + 'c'; break;
			case 13: code = code + 'd'; break;
			case 14: code = code + 'e'; break;
			case 15: code = code + 'f'; break;
			default: code = code + String(tmp); break;
		}
	}
	$('img#captcha_pic').attr('src', 'captcha.php?codeCaptcha='+code);
	$('input#codeCaptcha').val(code);
});
$('textarea#refer_other').live('click', function(e){
	$(':radio:last').attr('checked','checked');
});
//popupwindow
function popupWindow(url) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=420,screenX=150,screenY=150,top=150,left=150');
}
//socialbookmarks
$('div.productBookmarks a').live('mouseover', function(){
	$('div.productBookmarks span#bookmark').text($(this).attr('title'));
})
.live('mouseout', function(){
	$('div.productBookmarks span#bookmark').text('...');
})
.live('click', function(e){
	socialurl = encodeURIComponent(location.href);
	socialtitle = encodeURIComponent(document.title);
	switch ($(this).attr('class')) {
		case 'delicious':
			window.open('http://del.icio.us/post?url='+socialurl+'&title='+socialtitle);
			break;
		case 'wong':
			window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+socialurl+'&bm_description='+socialtitle);
			break;
		case 'blinklist':
			window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+socialurl+'&Title='+socialtitle);
			break;
		case 'yahoo':
			window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+socialurl+'&t='+socialtitle);
			break;
		case 'yigg':
			window.open('http://yigg.de/neu?exturl='+socialurl+'&exttitle='+socialtitle);
			break;
		case 'furl':
			window.open('http://www.furl.net/storeIt.jsp?u='+socialurl+'&t='+socialtitle);
			break;
		case 'oneview':
			window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+socialurl+'&title='+socialtitle);
			break;
		case 'folkd':
			window.open('http://www.folkd.com/submit/page/'+socialurl);
			break;
		case 'linkarena':
			window.open('http://linkarena.com/bookmarks/addlink/?url='+socialurl+'&title='+socialtitle+'&desc=&tags=');
			break;
		case 'google':
			window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+socialurl+'&title='+socialtitle);
			break;
		case 'webnews':
			window.open('http://www.webnews.de/einstellen?url='+socialurl+'&title='+socialtitle);
			break;
		case 'technorati':
			window.open('http://technorati.com/faves?add='+socialurl);
			break;
		case 'infopirat':
			window.open('http://infopirat.com/node/add/userlink?edit[url]='+socialurl+'&edit[title]='+socialtitle);
			break;
		case 'twitter':
			window.open('http://twitter.com/home?status='+socialtitle+'-'+socialurl);
			break;
		case 'stumbleupon':
			window.open('http://www.stumbleupon.com/submit?url='+socialurl);
			break;
	}
	e.preventDefault();
});
$(document).ready(function() {
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) {
		// get all pngs on page
		$('img[src$=.png]').each(function() {
			if (!this.complete) {
				this.onload = function() { fixPng(this) };
			} else {
				fixPng(this);
			}
		});
	}
});
var blank = new Image();
blank.src = 'core/transparent.gif';

function fixPng(png) {
	// get src
	var src = png.src;
	// set width and height
	if (!png.style.width) { png.style.width = $(png).width(); }
	if (!png.style.height) { png.style.height = $(png).height(); }
	// replace by blank image
	png.onload = function() { };
	png.src = blank.src;
	// set filter (display original image)
	png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}