// JavaScript Document

// CFG:
//var add_OEffectFadeTo = ['#accountInfo a img', '#menuTop a', '#footerMenu a'];

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        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(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        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 { // only name given, get cookie
        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]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};



/*
 * jNice
 * version: 1.0 (11.26.08)
 * by Sean Mooney (sean@whitespace-creative.com) 
 * Examples at: http://www.whitespace-creative.com/jquery/jnice/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * To Use: place in the head 
 *  <link href="inc/style/jNice.css" rel="stylesheet" type="text/css" />
 *  <script type="text/javascript" src="inc/js/jquery.jNice.js"></script>
 *
 * And apply the jNice class to the form you want to style
 *
 * To Do: Add textareas, Add File upload
 *
 ******************************************** */
(function($){
	$.fn.jNice = function(options){
		var self = this;
		var safari = $.browser.safari; /* We need to check for safari to fix the input:text problem */
		/* Apply document listener */
		$(document).mousedown(checkExternalClick);
		/* each form */
		return this.each(function(){
			//$('input:submit, input:reset, input:button', this).each(ButtonAdd);
			//$('button').focus(function(){ $(this).addClass('jNiceFocus')}).blur(function(){ $(this).removeClass('jNiceFocus')});
			//$('input:text:visible, input:password', this).each(TextAdd);
			/* If this is safari we need to add an extra class */
			//if (safari){$('.jNiceInputWrapper').each(function(){$(this).addClass('jNiceSafari').find('input').css('width', $(this).width()+11);});}
			$('input:checkbox', this).each(CheckAdd);
			$('input:radio', this).each(RadioAdd);
			//$('select', this).each(function(index){ SelectAdd(this, index); });
			/* Add a new handler for the reset action */
			//$(this).bind('reset',function(){var action = function(){ Reset(this); }; window.setTimeout(action, 10); });
			//$('.jNiceHidden').css({opacity:0});
		});		
	};/* End the Plugin */

	var Reset = function(form){
		var sel;
		$('.jNiceSelectWrapper select', form).each(function(){sel = (this.selectedIndex<0) ? 0 : this.selectedIndex; $('ul', $(this).parent()).each(function(){$('a:eq('+ sel +')', this).click();});});
		$('a.jNiceCheckbox, a.jNiceRadio', form).removeClass('jNiceChecked');
		$('input:checkbox, input:radio', form).each(function(){if(this.checked){$('a', $(this).parent()).addClass('jNiceChecked');}});
	};

	var RadioAdd = function(){
		var $input = $(this).addClass('jNiceHidden').wrap('<span class="jRadioWrapper jNiceWrapper"></span>');
		var $wrapper = $input.parent();
		var $a = $('<span class="jNiceRadio"></span>');
		$wrapper.prepend($a);
		/* Click Handler */
		$a.click(function(){
				var $input = $(this).addClass('jNiceChecked').siblings('input').attr('checked',true);
				/* uncheck all others of same name */
				$('input:radio[name="'+ $input.attr('name') +'"]').not($input).each(function(){
					$(this).attr('checked',false).siblings('.jNiceRadio').removeClass('jNiceChecked');
				});
				return false;
		});
		$input.click(function(){
			if(this.checked){
				var $input = $(this).siblings('.jNiceRadio').addClass('jNiceChecked').end();
				/* uncheck all others of same name */
				$('input:radio[name="'+ $input.attr('name') +'"]').not($input).each(function(){
					$(this).attr('checked',false).siblings('.jNiceRadio').removeClass('jNiceChecked');
				});
			}
		}).focus(function(){ $a.addClass('jNiceFocus'); }).blur(function(){ $a.removeClass('jNiceFocus'); });

		/* set the default state */
		if (this.checked){ $a.addClass('jNiceChecked'); }
	};

	var CheckAdd = function(){
		var $input = $(this).addClass('jNiceHidden').wrap('<span class="jNiceWrapper"></span>');
		var $wrapper = $input.parent().append('<span class="jNiceCheckbox"></span>');
		/* Click Handler */
		var $a = $wrapper.find('.jNiceCheckbox').click(function(){
				var $a = $(this);
				var input = $a.siblings('input')[0];
				if (input.checked===true){
					input.checked = false;
					$a.removeClass('jNiceChecked');
				}
				else {
					input.checked = true;
					$a.addClass('jNiceChecked');
				}
				return false;
		});
		$input.click(function(){
			if(this.checked){ $a.addClass('jNiceChecked'); 	}
			else { $a.removeClass('jNiceChecked'); }
		}).focus(function(){ $a.addClass('jNiceFocus'); }).blur(function(){ $a.removeClass('jNiceFocus'); });
		
		/* set the default state */
		if (this.checked){$('.jNiceCheckbox', $wrapper).addClass('jNiceChecked');}
	};

	var TextAdd = function(){
		var $input = $(this).addClass('jNiceInput').wrap('<div class="jNiceInputWrapper"><div class="jNiceInputInner"></div></div>');
		var $wrapper = $input.parents('.jNiceInputWrapper');
		$input.focus(function(){ 
			$wrapper.addClass('jNiceInputWrapper_hover');
		}).blur(function(){
			$wrapper.removeClass('jNiceInputWrapper_hover');
		});
	};

	var ButtonAdd = function(){
		var value = $(this).attr('value');
		$(this).replaceWith('<button id="'+ this.id +'" name="'+ this.name +'" type="'+ this.type +'" class="'+ this.className +'" value="'+ value +'"><span><span>'+ value +'</span></span>');
	};

	/* Hide all open selects */
	var SelectHide = function(){
			$('.jNiceSelectWrapper ul:visible').hide();
	};

	/* Check for an external click */
	var checkExternalClick = function(event) {
		if ($(event.target).parents('.jNiceSelectWrapper').length === 0) { SelectHide(); }
	};

	var SelectAdd = function(element, index){
		var $select = $(element);
		index = index || $select.css('zIndex')*1;
		index = (index) ? index : 0;
		/* First thing we do is Wrap it */
		$select.wrap($('<div class="jNiceWrapper"></div>').css({zIndex: 100-index}));
		var width = $select.width();
		$select.addClass('jNiceHidden').after('<div class="jNiceSelectWrapper"><div><span class="jNiceSelectText"></span><span class="jNiceSelectOpen"></span></div><ul></ul></div>');
		var $wrapper = $(element).siblings('.jNiceSelectWrapper').css({width: width +'px'});
		$('.jNiceSelectText, .jNiceSelectWrapper ul', $wrapper).width( width - $('.jNiceSelectOpen', $wrapper).width());
		/* IF IE 6 */
		if ($.browser.msie && jQuery.browser.version < 7) {
			$select.after($('<iframe src="javascript:\'\';" marginwidth="0" marginheight="0" align="bottom" scrolling="no" tabIndex="-1" frameborder="0"></iframe>').css({ height: $select.height()+4 +'px' }));
		}
		/* Now we add the options */
		SelectUpdate(element);
		/* Apply the click handler to the Open */
		$('div', $wrapper).click(function(){
			var $ul = $(this).siblings('ul');
			if ($ul.css('display')=='none'){ SelectHide(); } /* Check if box is already open to still allow toggle, but close all other selects */
			$ul.slideToggle();
			var offSet = ($('a.selected', $ul).offset().top - $ul.offset().top);
			$ul.animate({scrollTop: offSet});
			return false;
		});
		/* Add the key listener */
		$select.keydown(function(e){
			var selectedIndex = this.selectedIndex;
			switch(e.keyCode){
				case 40: /* Down */
					if (selectedIndex < this.options.length - 1){ selectedIndex+=1; }
					break;
				case 38: /* Up */
					if (selectedIndex > 0){ selectedIndex-=1; }
					break;
				default:
					return;
					break;
			}
			$('ul a', $wrapper).removeClass('selected').eq(selectedIndex).addClass('selected');
			$('span:eq(0)', $wrapper).html($('option:eq('+ selectedIndex +')', $select).attr('selected', 'selected').text());
			return false;
		}).focus(function(){ $wrapper.addClass('jNiceFocus'); }).blur(function(){ $wrapper.removeClass('jNiceFocus'); });
	};

	var SelectUpdate = function(element){
		var $select = $(element);
		var $wrapper = $select.siblings('.jNiceSelectWrapper');
		var $ul = $wrapper.find('ul').find('li').remove().end().hide();
		$('option', $select).each(function(i){
			$ul.append('<li><a href="#" index="'+ i +'">'+ this.text +'</a></li>');
		});
		/* Add click handler to the a */
		$ul.find('a').click(function(){
			$('a.selected', $wrapper).removeClass('selected');
			$(this).addClass('selected');	
			/* Fire the onchange event */
			if ($select[0].selectedIndex != $(this).attr('index') && $select[0].onchange) { $select[0].selectedIndex = $(this).attr('index'); $select[0].onchange(); }
			$select[0].selectedIndex = $(this).attr('index');
			$('span:eq(0)', $wrapper).html($(this).html());
			$ul.hide();
			return false;
		});
		/* Set the defalut */
		$('a:eq('+ $select[0].selectedIndex +')', $ul).click();
	};

	var SelectRemove = function(element){
		var zIndex = $(element).siblings('.jNiceSelectWrapper').css('zIndex');
		$(element).css({zIndex: zIndex}).removeClass('jNiceHidden');
		$(element).siblings('.jNiceSelectWrapper').remove();
	};

	/* Utilities */
	$.jNice = {
			SelectAdd : function(element, index){ 	SelectAdd(element, index); },
			SelectRemove : function(element){ SelectRemove(element); },
			SelectUpdate : function(element){ SelectUpdate(element); }
	};/* End Utilities */

	/* Automatically apply to any forms with class jNice */
	$(function(){$('form.jNice').jNice();});
})(jQuery);


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright ÂC 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});


Object.extend = function(dst, src){	for(var i in src){ dst[i]=src[i]; } return dst; }
Object.extend(String.prototype, {
	striptags: 	function() 			{return this.replace(/<\/?[^>]+>/gi, ''); },
	include: 	function(pattern) {return this.indexOf(pattern) > -1; },
	trim: 		function()			{return this.replace(new RegExp("^[\\s]+", "g"),"").replace(new RegExp("[\\s]+$", "g"),""); },
	isemail: 	function()			{
		chk = new RegExp(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$/).test(this);
		if( chk  || new RegExp(/@localhost$/).test(this) ) return true;
		return chk;
	},
	isdate: function(format){ var format; format?format:false;
		var date = this; var dimonth = [0,31,28,31,30,31,30,31,31,30,31,30,31];
		var tmp1 = date.split(/-|\//);
		var tmp2 = date.split(/-|\//);
		tmp1[0] = parseFloat(tmp1[0]); tmp1[1] = parseFloat(tmp1[1]); tmp1[2] = parseFloat(tmp1[2]);
		if( format == 2){ tmp1 = [ tmp1[2], tmp1[1], tmp1[0] ]; tmp2 = [ tmp2[2], tmp2[1], tmp2[0] ]; }
		
		if(	!( isNaN(tmp1[0]) || isNaN(tmp1[1]) || isNaN(tmp1[2]) ) && 
				!( tmp1[0] <= 0 || tmp1[1] <= 0 || tmp1[2] <= 0 ) &&
				!( tmp1[0] <= 0 || tmp1[1] <= 0 || tmp1[2] <= 0 ) && 
				!( tmp1[2] > 29 && tmp1[1] == 2 ) &&
				!( tmp1[2] == 29 && tmp1[1] == 2 && !(((tmp1[0] % 4 == 0) && (tmp1[0] % 100 != 0)) || (tmp1[0] % 400 == 0)) ) &&
				!( tmp1[1] > 12 ) && 
				!( tmp1[2] > dimonth[tmp1[1]] ) && 
				 ( new RegExp(/([0-9]{4})/).test( tmp2[0] ) && new RegExp(/([0-9]{1,2})/).test( tmp2[1] ) && new RegExp(/([0-9]{1,2})/).test( tmp2[2] )  ) ) return true;
		return false;
	},
	isimage: function(){
		return new RegExp(/(\.jpg|\.jpeg|\.gif|\.png|\.bmp)$/).test(this.toLowerCase());
	},
	empty: function(){
		return this.trim(this) == "";
	}
});


/*¨JQUERY extend ...*/
// JavaScript Document
/*
var __keyCodes = [];
__keyCodes['acc'] = [9,8,35,36,34,33];

__keyCodes['num'] = [48,49,50,51,52,53,54,55,56,57].add(__keyCodes['acc']);
__keyCodes['mon'] = [46,44,190,188,36,48,49,50,51,52,53,54,55,56,57].add(__keyCodes['acc']);
__keyCodes['alp'] = [113,119,101,114,116,121,117,105,111,112,97,115,100,102,103,104,106,107,108,241,122,120,99,118,98,110,109,220,32,252,225,233,237,243,250,193,201,205,211,218].add(__keyCodes['acc']);
__keyCodes['pun'] = [46,44,58,59,63,191,33,161,34,38,36].add(__keyCodes['acc']);
__keyCodes['fnc'] = [112,113,114,115,116,117,118,119,120,121,122,123].add(__keyCodes['acc']);
__keyCodes['nav'] = [37,38,39,40].add(__keyCodes['acc']);
__keyCodes['sof'] = [91].add(__keyCodes['acc']);
*/

(function($){
	$.fn.check = function(){
		if( arguments.length == 0 ){
			this.find("input:checkbox").each(function(){ $(this).attr('checked', !$(this).attr('checked') );  });
		}	else	{
			stat = arguments[0];
			this.find("input:checkbox").each(function(){ $(this).attr('checked', stat); });
		}
	};

	$.fn.enable = function(){
		this.attr('disabled', false);
	};

	$.fn.disable = function(){
		this.attr('disabled', true);
	};

	$.fn.display = function(nstat){ var nstat;
		this.css('display', ( ( nstat === true || nstat === false ) ? (nstat?"block":"none") : nstat ) );
	};

	$.fn.checked = function(){
		return this.attr('checked');
	};

	//$.fn.empty = function(){
		//return this.val().empty();
	//};
	
	$.fn.move = function(x,y){
		this.css({
			'top'  :  ($.is_number(y) ? y + "px" : y),
			'left' :  ($.is_number(x) ? x + "px" : x)
		});
	};
})(jQuery);

jQuery.chenabled = function(){
	var checkStat = !( arguments[0] === true  || arguments[0] === false );
	for(var i = (checkStat ? 0 : 1), n = arguments.length; i < n; i++){
		if( ( checkStat && $(arguments[i]).attr('disabled') ) || (!checkStat && arguments[0] == true) ){
			$(arguments[i]).enable();
		}	else	{
			$(arguments[i]).disable();
		}
	}
}

jQuery.display = function(){
	var action = false;
	var initin = 0;
	if( arguments[0] === true || arguments[0] === false ){initin = 1; action = arguments[0];}

	for(var i = initin, n = arguments.length; i < n; i++){
		if( arguments[i] == '|' ){action = !action; continue;}
		$(arguments[i]).display(action);
	}
}

jQuery.switchdisplay = function(){
	for(var i = 0, n = arguments.length; i < n; i++){
		$(arguments[i]).display( $(arguments[i]).css('display') != 'block' );
	}
}

jQuery.ifpress = function( e, codes, doEvent ){ var e =(e||window.event), codes, doEvent, kcode;
	codes = $.is_array( codes ) ? codes : [codes];
	kcode = e.keyCode||e.which; //alert(kcode);
	if( in_array( kcode, codes ) ){
		e.handled = true;	eval(doEvent); return true;
	}	return false;
}

jQuery.transfer_options = function( src, dst ){
	var src_options = $(src + ' option:selected');
	for( var i =0, n = src_options.length; i < n; i++ ){
		$(dst).append( src_options[i] );
	}
	for( var i =0, n = src_options.length; i < n; i++ ){
		try { $(src).remove( src_options[i] ); } catch(e){}
	}
}

jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++){jQuery("<img>").attr("src", arguments[i]);}
}

jQuery.is_array 	= function(object){ var object;	return object && object.constructor === Array; }
jQuery.is_node	 	= function(object){ var object;	return object && object.nodeType == 1; }
jQuery.is_function= function(object){ var object;	return typeof object == "function"; }
jQuery.is_string	= function(object){ var object;	return typeof object == "string"; }
jQuery.is_number	= function(object){ var object;	return typeof object == "number"; }
jQuery.is_undef	= function(object){ var object;	return typeof object == "undefined"; }

// sprintf
function sprintf(){
	var str = arguments[0];
	for( var i = 1; i < arguments.length; i++ ){
		str = str.replace(/%s/i, arguments[i] );
	}	return str;
}

// str_repeat
function str_repeat(String_Repeat, Int_Count){ var String_Repeat, Int_Count, ReturnString = "";
	for(var i=0;i<=Int_Count;i++) ReturnString+= String_Repeat; return ReturnString;
}

// in_array
function in_array(Search, Array_SearchIn){
	if(!$.is_array( Array_SearchIn) ) return false;
	for(var i in Array_SearchIn){
		if( Array_SearchIn[i] == Search) return true;
	}	return false;
}

var rotations_cc = [];
function rotationBannersPL(x,c,r,z){ var x, c, r,z;
	var n = r;
	if( document.getElementById(x).stopprop == 0){
		n = r+1 > c? 0: r+1;
		var k = $("#"+x).find('img').get(r);
		$(k).css('visibility','visible').fadeOut(2000, function(){
			//if( document.getElementById(x).stopprop == 0){
				$(k).css('visibility','hidden')
				var u = $("#"+x).find('img').get(n);
				$('#'+x).find('p a').removeClass('active');
				$($('#'+x).find('p a').get( c-n )).addClass('active');
				$(u).css({'visibility':'visible'}).fadeOut(0).fadeIn(2000);
			//}
		});
	}
	rotations_cc[z] = setTimeout("rotationBannersPL('"+ x + "', "+ c +", "+ n +", "+ z+");", 5000);
}

function rotationBannersDR(f, p, x, i, y){ var f, p, x, i, y;
	clearTimeout(rotations_cc[i]);
	document.getElementById(p).stopprop = 1;
	$("#"+p+ " img").fadeOut(0).css('visibility','hidden');
	$($("#"+p+ " img").get(y-1)).fadeIn(0).css('visibility','visible');
	$("#"+p+ " p a").removeClass('active');
	$(f).addClass('active');
	rotations_cc[i] = setTimeout("rotationBannersPL('"+p+"'"+","+x+","+y+","+i+");document.getElementById('"+p+"').stopprop = 0;", 10000 );
}


var $wload = {parm: new Array(), eval: function(){	for(var i=0;i<this.parm.length;i++){ eval(this.parm[i]); } }, add: function(q){ var q;	this.parm.unshift(q); } };
$(document).ready(function(){
	$wload.eval();

	$('.rotation_banners').each(function(i){
		var x = $(this);
		var y = this;
		if( !x.attr('id') ){ x.attr('id', 'rotation_banner_count_' + i); }

		var m = x.find('img').css('visibility', 'hidden');
		y.stopprop = 0;
		x.hover( function(){y.stopprop = 1;}, 	function(){y.stopprop = 0;});
		
		for(var j=m.length;j>0;j--){
			$('<a href="javascript:;" onclick="rotationBannersDR(this,\''+x.attr('id')+'\','+(m.length-1)+','+i+','+j+');" class="'+(j+1==m.length?"active":"")+'">'+(j)+'</a>').appendTo(x.find('p').get(0));
		}

		x.find('img:first').css('visibility', 'visible');
		rotations_cc[i] = setTimeout("rotationBannersPL('"+ x.attr('id') + "', "+ (m.length-1) +", "+ 0 +", "+ i +");", 5000);
	});
});
