/*

    http://www.JSON.org/json2.js

    2008-09-01



    Public Domain.



    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.



    See http://www.JSON.org/js.html



    This file creates a global JSON object containing two methods: stringify

    and parse.



        JSON.stringify(value, replacer, space)

            value       any JavaScript value, usually an object or array.



            replacer    an optional parameter that determines how object

                        values are stringified for objects. It can be a

                        function or an array of strings.



            space       an optional parameter that specifies the indentation

                        of nested structures. If it is omitted, the text will

                        be packed without extra whitespace. If it is a number,

                        it will specify the number of spaces to indent at each

                        level. If it is a string (such as '\t' or '&nbsp;'),

                        it contains the characters used to indent at each level.



            This method produces a JSON text from a JavaScript value.



            When an object value is found, if the object contains a toJSON

            method, its toJSON method will be called and the result will be

            stringified. A toJSON method does not serialize: it returns the

            value represented by the name/value pair that should be serialized,

            or undefined if nothing should be serialized. The toJSON method

            will be passed the key associated with the value, and this will be

            bound to the object holding the key.



            For example, this would serialize Dates as ISO strings.



                Date.prototype.toJSON = function (key) {

                    function f(n) {

                        // Format integers to have at least two digits.

                        return n < 10 ? '0' + n : n;

                    }



                    return this.getUTCFullYear()   + '-' +

                         f(this.getUTCMonth() + 1) + '-' +

                         f(this.getUTCDate())      + 'T' +

                         f(this.getUTCHours())     + ':' +

                         f(this.getUTCMinutes())   + ':' +

                         f(this.getUTCSeconds())   + 'Z';

                };



            You can provide an optional replacer method. It will be passed the

            key and value of each member, with this bound to the containing

            object. The value that is returned from your method will be

            serialized. If your method returns undefined, then the member will

            be excluded from the serialization.



            If the replacer parameter is an array of strings, then it will be used to

            select the members to be serialized. It filters the results such

            that only members with keys listed in the replacer array are

            stringified.



            Values that do not have JSON representations, such as undefined or

            functions, will not be serialized. Such values in objects will be

            dropped; in arrays they will be replaced with null. You can use

            a replacer function to replace those with JSON values.

            JSON.stringify(undefined) returns undefined.



            The optional space parameter produces a stringification of the

            value that is filled with line breaks and indentation to make it

            easier to read.



            If the space parameter is a non-empty string, then that string will

            be used for indentation. If the space parameter is a number, then

            the indentation will be that many spaces.



            Example:



            text = JSON.stringify(['e', {pluribus: 'unum'}]);

            // text is '["e",{"pluribus":"unum"}]'





            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');

            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'



            text = JSON.stringify([new Date()], function (key, value) {

                return this[key] instanceof Date ?

                    'Date(' + this[key] + ')' : value;

            });

            // text is '["Date(---current time---)"]'





        JSON.parse(text, reviver)

            This method parses a JSON text to produce an object or array.

            It can throw a SyntaxError exception.



            The optional reviver parameter is a function that can filter and

            transform the results. It receives each of the keys and values,

            and its return value is used instead of the original value.

            If it returns what it received, then the structure is not modified.

            If it returns undefined then the member is deleted.



            Example:



            // Parse the text. Values that look like ISO date strings will

            // be converted to Date objects.



            myData = JSON.parse(text, function (key, value) {

                var a;

                if (typeof value === 'string') {

                    a =

/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);

                    if (a) {

                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],

                            +a[5], +a[6]));

                    }

                }

                return value;

            });



            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {

                var d;

                if (typeof value === 'string' &&

                        value.slice(0, 5) === 'Date(' &&

                        value.slice(-1) === ')') {

                    d = new Date(value.slice(5, -1));

                    if (d) {

                        return d;

                    }

                }

                return value;

            });





    This is a reference implementation. You are free to copy, modify, or

    redistribute.



    This code should be minified before deployment.

    See http://javascript.crockford.com/jsmin.html



    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO

    NOT CONTROL.

*/



/*jslint evil: true */



/*global JSON */



/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", call,

    charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes,

    getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length,

    parse, propertyIsEnumerable, prototype, push, replace, slice, stringify,

    test, toJSON, toString, valueOf

*/



// Create a JSON object only if one does not already exist. We create the

// methods in a closure to avoid creating global variables.



if (!this.JSON) {

    JSON = {};

}

(function () {



    function f(n) {

        // Format integers to have at least two digits.

        return n < 10 ? '0' + n : n;

    }



    if (typeof Date.prototype.toJSON !== 'function') {



        Date.prototype.toJSON = function (key) {



            return this.getUTCFullYear()   + '-' +

                 f(this.getUTCMonth() + 1) + '-' +

                 f(this.getUTCDate())      + 'T' +

                 f(this.getUTCHours())     + ':' +

                 f(this.getUTCMinutes())   + ':' +

                 f(this.getUTCSeconds())   + 'Z';

        };



        String.prototype.toJSON =

        Number.prototype.toJSON =

        Boolean.prototype.toJSON = function (key) {

            return this.valueOf();

        };

    }



    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,

        escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,

        gap,

        indent,

        meta = {    // table of character substitutions

            '\b': '\\b',

            '\t': '\\t',

            '\n': '\\n',

            '\f': '\\f',

            '\r': '\\r',

            '"' : '\\"',

            '\\': '\\\\'

        },

        rep;





    function quote(string) {



// If the string contains no control characters, no quote characters, and no

// backslash characters, then we can safely slap some quotes around it.

// Otherwise we must also replace the offending characters with safe escape

// sequences.



        escapeable.lastIndex = 0;

        return escapeable.test(string) ?

            '"' + string.replace(escapeable, function (a) {

                var c = meta[a];

                if (typeof c === 'string') {

                    return c;

                }

                return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);

            }) + '"' :

            '"' + string + '"';

    }





    function str(key, holder) {



// Produce a string from holder[key].



        var i,          // The loop counter.

            k,          // The member key.

            v,          // The member value.

            length,

            mind = gap,

            partial,

            value = holder[key];



// If the value has a toJSON method, call it to obtain a replacement value.



        if (value && typeof value === 'object' &&

                typeof value.toJSON === 'function') {

            value = value.toJSON(key);

        }



// If we were called with a replacer function, then call the replacer to

// obtain a replacement value.



        if (typeof rep === 'function') {

            value = rep.call(holder, key, value);

        }



// What happens next depends on the value's type.



        switch (typeof value) {

        case 'string':

            return quote(value);



        case 'number':



// JSON numbers must be finite. Encode non-finite numbers as null.



            return isFinite(value) ? String(value) : 'null';



        case 'boolean':

        case 'null':



// If the value is a boolean or null, convert it to a string. Note:

// typeof null does not produce 'null'. The case is included here in

// the remote chance that this gets fixed someday.



            return String(value);



// If the type is 'object', we might be dealing with an object or an array or

// null.



        case 'object':



// Due to a specification blunder in ECMAScript, typeof null is 'object',

// so watch out for that case.



            if (!value) {

                return 'null';

            }



// Make an array to hold the partial results of stringifying this object value.



            gap += indent;

            partial = [];



// If the object has a dontEnum length property, we'll treat it as an array.



            if (typeof value.length === 'number' &&

                    !value.propertyIsEnumerable('length')) {



// The object is an array. Stringify every element. Use null as a placeholder

// for non-JSON values.



                length = value.length;

                for (i = 0; i < length; i += 1) {

                    partial[i] = str(i, value) || 'null';

                }



// Join all of the elements together, separated with commas, and wrap them in

// brackets.



                v = partial.length === 0 ? '[]' :

                    gap ? '[\n' + gap +

                            partial.join(',\n' + gap) + '\n' +

                                mind + ']' :

                          '[' + partial.join(',') + ']';

                gap = mind;

                return v;

            }



// If the replacer is an array, use it to select the members to be stringified.



            if (rep && typeof rep === 'object') {

                length = rep.length;

                for (i = 0; i < length; i += 1) {

                    k = rep[i];

                    if (typeof k === 'string') {

                        v = str(k, value);

                        if (v) {

                            partial.push(quote(k) + (gap ? ': ' : ':') + v);

                        }

                    }

                }

            } else {



// Otherwise, iterate through all of the keys in the object.



                for (k in value) {

                    if (Object.hasOwnProperty.call(value, k)) {

                        v = str(k, value);

                        if (v) {

                            partial.push(quote(k) + (gap ? ': ' : ':') + v);

                        }

                    }

                }

            }



// Join all of the member texts together, separated with commas,

// and wrap them in braces.



            v = partial.length === 0 ? '{}' :

                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +

                        mind + '}' : '{' + partial.join(',') + '}';

            gap = mind;

            return v;

        }

    }



// If the JSON object does not yet have a stringify method, give it one.



    if (typeof JSON.stringify !== 'function') {

        JSON.stringify = function (value, replacer, space) {



// The stringify method takes a value and an optional replacer, and an optional

// space parameter, and returns a JSON text. The replacer can be a function

// that can replace values, or an array of strings that will select the keys.

// A default replacer method can be provided. Use of the space parameter can

// produce text that is more easily readable.



            var i;

            gap = '';

            indent = '';



// If the space parameter is a number, make an indent string containing that

// many spaces.



            if (typeof space === 'number') {

                for (i = 0; i < space; i += 1) {

                    indent += ' ';

                }



// If the space parameter is a string, it will be used as the indent string.



            } else if (typeof space === 'string') {

                indent = space;

            }



// If there is a replacer, it must be a function or an array.

// Otherwise, throw an error.



            rep = replacer;

            if (replacer && typeof replacer !== 'function' &&

                    (typeof replacer !== 'object' ||

                     typeof replacer.length !== 'number')) {

                throw new Error('JSON.stringify');

            }



// Make a fake root object containing our value under the key of ''.

// Return the result of stringifying the value.



            return str('', {'': value});

        };

    }





// If the JSON object does not yet have a parse method, give it one.



    if (typeof JSON.parse !== 'function') {

        JSON.parse = function (text, reviver) {



// The parse method takes a text and an optional reviver function, and returns

// a JavaScript value if the text is a valid JSON text.



            var j;



            function walk(holder, key) {



// The walk method is used to recursively walk the resulting structure so

// that modifications can be made.



                var k, v, value = holder[key];

                if (value && typeof value === 'object') {

                    for (k in value) {

                        if (Object.hasOwnProperty.call(value, k)) {

                            v = walk(value, k);

                            if (v !== undefined) {

                                value[k] = v;

                            } else {

                                delete value[k];

                            }

                        }

                    }

                }

                return reviver.call(holder, key, value);

            }





// Parsing happens in four stages. In the first stage, we replace certain

// Unicode characters with escape sequences. JavaScript handles many characters

// incorrectly, either silently deleting them, or treating them as line endings.



            cx.lastIndex = 0;

            if (cx.test(text)) {

                text = text.replace(cx, function (a) {

                    return '\\u' +

                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);

                });

            }



// In the second stage, we run the text against regular expressions that look

// for non-JSON patterns. We are especially concerned with '()' and 'new'

// because they can cause invocation, and '=' because it can cause mutation.

// But just to be safe, we want to reject all unexpected forms.



// We split the second stage into 4 regexp operations in order to work around

// crippling inefficiencies in IE's and Safari's regexp engines. First we

// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we

// replace all simple value tokens with ']' characters. Third, we delete all

// open brackets that follow a colon or comma or that begin the text. Finally,

// we look to see that the remaining characters are only whitespace or ']' or

// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.



            if (/^[\],:{}\s]*$/.

test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').

replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').

replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {



// In the third stage we use the eval function to compile the text into a

// JavaScript structure. The '{' operator is subject to a syntactic ambiguity

// in JavaScript: it can begin a block or an object literal. We wrap the text

// in parens to eliminate the ambiguity.



                j = eval('(' + text + ')');



// In the optional fourth stage, we recursively walk the new structure, passing

// each name/value pair to a reviver function for possible transformation.



                return typeof reviver === 'function' ?

                    walk({'': j}, '') : j;

            }



// If the text is not JSON parseable, then a SyntaxError is thrown.



            throw new SyntaxError('JSON.parse');

        };

    }

})();



/* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */

/* Written by Andrew Stromnov (stromnov@gmail.com). */

jQuery(function($){

	$.datepicker.regional['ru'] = {clearText: 'Очистить', clearStatus: '',

		closeText: 'Закрыть', closeStatus: '',

		prevText: '&lt;Пред',  prevStatus: '',

		nextText: 'След&gt;', nextStatus: '',

		currentText: 'Сегодня', currentStatus: '',

		monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',

		'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],

		monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',

		'Июл','Авг','Сен','Окт','Ноя','Дек'],

		monthStatus: '', yearStatus: '',

		weekHeader: 'Не', weekStatus: '',

		dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],

		dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],

		dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],

		dayStatus: 'DD', dateStatus: 'D, M d',

		dateFormat: 'dd.mm.yy', firstDay: 1, 

		initStatus: '', isRTL: false};

	$.datepicker.setDefaults($.datepicker.regional['ru']);

});



/*

 ### jQuery Star Rating Plugin v2.5 - 2008-09-10 ###

 * http://www.fyneworks.com/ - diego@fyneworks.com

 * Dual licensed under the MIT and GPL licenses:

 *   http://www.opensource.org/licenses/mit-license.php

 *   http://www.gnu.org/licenses/gpl.html

 ###

 Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating

 Website: http://www.fyneworks.com/jquery/star-rating/

*//*

	Based on http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/

 Original comments:

	This is hacked version of star rating created by <a href="http://php.scripts.psu.edu/rja171/widgets/rating.php">Ritesh Agrawal</a>

	It thansform a set of radio type input elements to star rating type and remain the radio element name and value,

	so could be integrated with your form. It acts as a normal radio button.

	modified by : Logan Cai (cailongqun[at]yahoo.com.cn)

*/



/*# AVOID COLLISIONS #*/

;if(window.jQuery) (function($){

/*# AVOID COLLISIONS #*/

	

	// default settings

	$.rating = {

		cancel: 'Cancel Rating',   // advisory title for the 'cancel' link

		cancelValue: '',           // value to submit when user click the 'cancel' link

		split: 0,                  // split the star into how many parts?

		

		// Width of star image in case the plugin can't work it out. This can happen if

		// the jQuery.dimensions plugin is not available OR the image is hidden at installation

		starWidth: 16,

		

		//NB.: These don't need to be defined (can be undefined/null) so let's save some code!

		//half:     false,         // just a shortcut to settings.split = 2

		required: true,         // disables the 'cancel' button so user can only select one of the specified values

		//readOnly: false,         // disable rating plugin interaction/ values cannot be changed

		//focus:    function(){},  // executed when stars are focused

		//blur:     function(){},  // executed when stars are focused

		//callback: function(){},  // executed when a star is clicked

		

		// required properties:

		groups: {},// allows multiple star ratings on one page

		event: {// plugin event handlers

			fill: function(n, el, settings, state){ // fill to the current mouse position.

				//if(window.console) console.log(['fill', $(el), $(el).prevAll('.star_group_'+n), arguments]);

				this.drain(n);

				$(el).prevAll('.star_group_'+n).andSelf().addClass('star_'+(state || 'hover'));

				// focus handler, as requested by focusdigital.co.uk

				var lnk = $(el).children('a'); val = lnk.text();

				if(settings.focus) settings.focus.apply($.rating.groups[n].valueElem[0], [val, lnk[0]]);

			},

			drain: function(n, el, settings) { // drain all the stars.

				//if(window.console) console.log(['drain', $(el), $(el).prevAll('.star_group_'+n), arguments]);

				$.rating.groups[n].valueElem.siblings('.star_group_'+n).removeClass('star_on').removeClass('star_hover');

			},

			reset: function(n, el, settings){ // Reset the stars to the default index.

				if(!$($.rating.groups[n].current).is('.cancel'))

					$($.rating.groups[n].current).prevAll('.star_group_'+n).andSelf().addClass('star_on');

				// blur handler, as requested by focusdigital.co.uk

				var lnk = $(el).children('a'); val = lnk.text();

				if(settings.blur) settings.blur.apply($.rating.groups[n].valueElem[0], [val, lnk[0]]);

			},

			click: function(n, el, settings){ // Selected a star or cancelled

				$.rating.groups[n].current = el;

				var lnk = $(el).children('a'); val = lnk.text();

				// Set value

				$.rating.groups[n].valueElem.val(val);

				// Update display

				$.rating.event.drain(n, el, settings);

				$.rating.event.reset(n, el, settings);

				// click callback, as requested here: http://plugins.jquery.com/node/1655

				if(settings.callback) settings.callback.apply($.rating.groups[n].valueElem[0], [val, lnk[0]]);

			}      

		}// plugin events

	};

	

	$.fn.rating = function(instanceSettings){

		if(this.length==0) return this; // quick fail

		

		instanceSettings = $.extend(

			{}/* new object */,

			$.rating/* global settings */,

			instanceSettings || {} /* just-in-time settings */

		);

		

		// loop through each matched element

		this.each(function(i){

			

			var settings = $.extend(

				{}/* new object */,

				instanceSettings || {} /* current call settings */,

				($.metadata? $(this).metadata(): ($.meta?$(this).data():null)) || {} /* metadata settings */

			);

			

			////if(window.console) console.log([this.name, settings.half, settings.split], '#');

			

			// Generate internal control ID

			// - ignore square brackets in element names

			var n = (this.name || 'unnamed-rating').replace(/\[|\]/, "_");

   

			// Grouping

			if(!$.rating.groups[n]) $.rating.groups[n] = {count: 0};

			i = $.rating.groups[n].count; $.rating.groups[n].count++;

			

			// Accept readOnly setting from 'disabled' property

			$.rating.groups[n].readOnly = $.rating.groups[n].readOnly || settings.readOnly || $(this).attr('disabled');

			

			// Things to do with the first element...

			if(i == 0){

				// Create value element (disabled if readOnly)

				$.rating.groups[n].valueElem = $('<input type="hidden" name="' + n + '" value=""' + (settings.readOnly ? ' disabled="disabled"' : '') + '/>');

				// Insert value element into form

				$(this).before($.rating.groups[n].valueElem);

				

				if($.rating.groups[n].readOnly || settings.required){

					// DO NOT display 'cancel' button

				}

				else{

					// Display 'cancel' button

					$(this).before(

						$('<div class="cancel"><a title="' + settings.cancel + '">' + settings.cancelValue + '</a></div>')

						.mouseover(function(){ $.rating.event.drain(n, this, settings); $(this).addClass('star_on'); })

						.mouseout(function(){ $.rating.event.reset(n, this, settings); $(this).removeClass('star_on'); })

						.click(function(){ $.rating.event.click(n, this, settings); })

					);

				}

			}; // if (i == 0) (first element)

			

			// insert rating option right after preview element

			eStar = $('<div class="star"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');

			$(this).after(eStar);

			

			// Half-stars?

			if(settings.half) settings.split = 2;

			

			// Prepare division settings

			if(typeof settings.split=='number' && settings.split>0){

				var stw = ($.fn.width ? $(eStar).width() : 0) || settings.starWidth;

				var spi = (i % settings.split), spw = Math.floor(stw/settings.split);

				$(eStar)

				// restrict star's width and hide overflow (already in CSS)

				.width(spw)

				// move the star left by using a negative margin

				// this is work-around to IE's stupid box model (position:relative doesn't work)

				.find('a').css({ 'margin-left':'-'+ (spi*spw) +'px' })

			};

			

			// Remember group name so controls within the same container don't get mixed up

			$(eStar).addClass('star_group_'+n);

			

			// readOnly?

			if($.rating.groups[n].readOnly)//{ //save a byte!

				// Mark star as readOnly so user can customize display

				$(eStar).addClass('star_readonly');

			//}  //save a byte!

			else//{ //save a byte!

				$(eStar)

				// Enable hover css effects

				.addClass('star_live')

				// Attach mouse events

				.mouseover(function(){ $.rating.event.drain(n, this, settings); $.rating.event.fill(n, this, settings, 'hover'); })

				.mouseout(function(){ $.rating.event.drain(n, this, settings); $.rating.event.reset(n, this, settings); })

				.click(function(){ $.rating.event.click(n, this, settings); });

			//}; //save a byte!

			

			////if(window.console) console.log(['###', n, this.checked, $.rating.groups[n].initial]);

			if(this.checked) $.rating.groups[n].current = eStar;

			

			//remove this checkbox

			$(this).remove();

			

			// reset display if last element

			if(i + 1 == this.length) $.rating.event.reset(n, this, settings);

		

		}); // each element

			

		// initialize groups...

		for(n in $.rating.groups)//{ not needed, save a byte!

			(function(c, v, n){ if(!c) return;

				$.rating.event.fill(n, c, instanceSettings || {}, 'on');

				$(v).val($(c).children('a').text());

			})

			($.rating.groups[n].current, $.rating.groups[n].valueElem, n);

		//}; not needed, save a byte!

		

		return this; // don't break the chain...

	};

	

	

	

	/*

		### Default implementation ###

		The plugin will attach itself to file inputs

		with the class 'multi' when the page loads

	*/

	$(function(){ $('input[@type=radio].star').rating(); });

	

	

	

/*# AVOID COLLISIONS #*/

})(jQuery);

/*# AVOID COLLISIONS #*/




/*

 * Autocomplete - jQuery plugin 1.0.2

 *

 * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer

 *

 * Dual licensed under the MIT and GPL licenses:

 *   http://www.opensource.org/licenses/mit-license.php

 *   http://www.gnu.org/licenses/gpl.html

 *

 * Revision: $Id: jquery.autocomplete.js 6829 2008-12-23 12:35:07Z newonder $

 *

 */

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){$.31.1o({12:3(b,d){5 c=Y b=="1w";d=$.1o({},$.D.1L,{11:c?b:14,w:c?14:b,1D:c?$.D.1L.1D:10,Z:d&&!d.1x?10:3U},d);d.1t=d.1t||3(a){6 a};d.1q=d.1q||d.1K;6 I.K(3(){1E $.D(I,d)})},M:3(a){6 I.X("M",a)},1y:3(a){6 I.15("1y",[a])},20:3(){6 I.15("20")},1Y:3(a){6 I.15("1Y",[a])},1X:3(){6 I.15("1X")}});$.D=3(o,r){5 t={2N:38,2I:40,2D:46,2x:9,2v:13,2q:27,2d:3x,2j:33,2o:34,2e:8};5 u=$(o).3f("12","3c").P(r.24);5 p;5 m="";5 n=$.D.2W(r);5 s=0;5 k;5 h={1z:B};5 l=$.D.2Q(r,o,1U,h);5 j;$.1T.2L&&$(o.2K).X("3S.12",3(){4(j){j=B;6 B}});u.X(($.1T.2L?"3Q":"3N")+".12",3(a){k=a.2F;3L(a.2F){Q t.2N:a.1d();4(l.L()){l.2y()}A{W(0,C)}N;Q t.2I:a.1d();4(l.L()){l.2u()}A{W(0,C)}N;Q t.2j:a.1d();4(l.L()){l.2t()}A{W(0,C)}N;Q t.2o:a.1d();4(l.L()){l.2s()}A{W(0,C)}N;Q r.19&&$.1p(r.R)==","&&t.2d:Q t.2x:Q t.2v:4(1U()){a.1d();j=C;6 B}N;Q t.2q:l.U();N;3A:1I(p);p=1H(W,r.1D);N}}).1G(3(){s++}).3v(3(){s=0;4(!h.1z){2k()}}).2i(3(){4(s++>1&&!l.L()){W(0,C)}}).X("1y",3(){5 c=(1n.7>1)?1n[1]:14;3 23(q,a){5 b;4(a&&a.7){16(5 i=0;i<a.7;i++){4(a[i].M.O()==q.O()){b=a[i];N}}}4(Y c=="3")c(b);A u.15("M",b&&[b.w,b.H])}$.K(1g(u.J()),3(i,a){1R(a,23,23)})}).X("20",3(){n.18()}).X("1Y",3(){$.1o(r,1n[1]);4("w"2G 1n[1])n.1f()}).X("1X",3(){l.1u();u.1u();$(o.2K).1u(".12")});3 1U(){5 b=l.26();4(!b)6 B;5 v=b.M;m=v;4(r.19){5 a=1g(u.J());4(a.7>1){v=a.17(0,a.7-1).2Z(r.R)+r.R+v}v+=r.R}u.J(v);1l();u.15("M",[b.w,b.H]);6 C}3 W(b,c){4(k==t.2D){l.U();6}5 a=u.J();4(!c&&a==m)6;m=a;a=1k(a);4(a.7>=r.22){u.P(r.21);4(!r.1C)a=a.O();1R(a,2V,1l)}A{1B();l.U()}};3 1g(b){4(!b){6[""]}5 d=b.1Z(r.R);5 c=[];$.K(d,3(i,a){4($.1p(a))c[i]=$.1p(a)});6 c}3 1k(a){4(!r.19)6 a;5 b=1g(a);6 b[b.7-1]}3 1A(q,a){4(r.1A&&(1k(u.J()).O()==q.O())&&k!=t.2e){u.J(u.J()+a.48(1k(m).7));$.D.1N(o,m.7,m.7+a.7)}};3 2k(){1I(p);p=1H(1l,47)};3 1l(){5 c=l.L();l.U();1I(p);1B();4(r.2U){u.1y(3(a){4(!a){4(r.19){5 b=1g(u.J()).17(0,-1);u.J(b.2Z(r.R)+(b.7?r.R:""))}A u.J("")}})}4(c)$.D.1N(o,o.H.7,o.H.7)};3 2V(q,a){4(a&&a.7&&s){1B();l.2T(a,q);1A(q,a[0].H);l.1W()}A{1l()}};3 1R(f,d,g){4(!r.1C)f=f.O();5 e=n.2S(f);4(e&&e.7){d(f,e)}A 4((Y r.11=="1w")&&(r.11.7>0)){5 c={45:+1E 44()};$.K(r.2R,3(a,b){c[a]=Y b=="3"?b():b});$.43({42:"41",3Z:"12"+o.3Y,2M:r.2M,11:r.11,w:$.1o({q:1k(f),3X:r.Z},c),3W:3(a){5 b=r.1r&&r.1r(a)||1r(a);n.1h(f,b);d(f,b)}})}A{l.2J();g(f)}};3 1r(c){5 d=[];5 b=c.1Z("\\n");16(5 i=0;i<b.7;i++){5 a=$.1p(b[i]);4(a){a=a.1Z("|");d[d.7]={w:a,H:a[0],M:r.1v&&r.1v(a,a[0])||a[0]}}}6 d};3 1B(){u.1e(r.21)}};$.D.1L={24:"3R",2H:"3P",21:"3O",22:1,1D:3M,1C:B,1a:C,1V:B,1j:10,Z:3K,2U:B,2R:{},1S:C,1K:3(a){6 a[0]},1q:14,1A:B,E:0,19:B,R:", ",1t:3(b,a){6 b.2C(1E 3J("(?![^&;]+;)(?!<[^<>]*)("+a.2C(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2A,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2A"),"<2z>$1</2z>")},1x:C,1s:3I};$.D.2W=3(g){5 h={};5 j=0;3 1a(s,a){4(!g.1C)s=s.O();5 i=s.3H(a);4(i==-1)6 B;6 i==0||g.1V};3 1h(q,a){4(j>g.1j){18()}4(!h[q]){j++}h[q]=a}3 1f(){4(!g.w)6 B;5 f={},2w=0;4(!g.11)g.1j=1;f[""]=[];16(5 i=0,30=g.w.7;i<30;i++){5 c=g.w[i];c=(Y c=="1w")?[c]:c;5 d=g.1q(c,i+1,g.w.7);4(d===B)1P;5 e=d.3G(0).O();4(!f[e])f[e]=[];5 b={H:d,w:c,M:g.1v&&g.1v(c)||d};f[e].1O(b);4(2w++<g.Z){f[""].1O(b)}};$.K(f,3(i,a){g.1j++;1h(i,a)})}1H(1f,25);3 18(){h={};j=0}6{18:18,1h:1h,1f:1f,2S:3(q){4(!g.1j||!j)6 14;4(!g.11&&g.1V){5 a=[];16(5 k 2G h){4(k.7>0){5 c=h[k];$.K(c,3(i,x){4(1a(x.H,q)){a.1O(x)}})}}6 a}A 4(h[q]){6 h[q]}A 4(g.1a){16(5 i=q.7-1;i>=g.22;i--){5 c=h[q.3F(0,i)];4(c){5 a=[];$.K(c,3(i,x){4(1a(x.H,q)){a[a.7]=x}});6 a}}}6 14}}};$.D.2Q=3(e,g,f,k){5 h={G:"3E"};5 j,y=-1,w,1m="",1M=C,F,z;3 2r(){4(!1M)6;F=$("<3D/>").U().P(e.2H).T("3C","3B").1J(2p.2n);z=$("<3z/>").1J(F).3y(3(a){4(V(a).2m&&V(a).2m.3w()==\'2l\'){y=$("1F",z).1e(h.G).3u(V(a));$(V(a)).P(h.G)}}).2i(3(a){$(V(a)).P(h.G);f();g.1G();6 B}).3t(3(){k.1z=C}).3s(3(){k.1z=B});4(e.E>0)F.T("E",e.E);1M=B}3 V(a){5 b=a.V;3r(b&&b.3q!="2l")b=b.3p;4(!b)6[];6 b}3 S(b){j.17(y,y+1).1e(h.G);2h(b);5 a=j.17(y,y+1).P(h.G);4(e.1x){5 c=0;j.17(0,y).K(3(){c+=I.1i});4((c+a[0].1i-z.1c())>z[0].3o){z.1c(c+a[0].1i-z.3n())}A 4(c<z.1c()){z.1c(c)}}};3 2h(a){y+=a;4(y<0){y=j.1b()-1}A 4(y>=j.1b()){y=0}}3 2g(a){6 e.Z&&e.Z<a?e.Z:a}3 2f(){z.2B();5 b=2g(w.7);16(5 i=0;i<b;i++){4(!w[i])1P;5 a=e.1K(w[i].w,i+1,b,w[i].H,1m);4(a===B)1P;5 c=$("<1F/>").3m(e.1t(a,1m)).P(i%2==0?"3l":"3k").1J(z)[0];$.w(c,"2c",w[i])}j=z.3j("1F");4(e.1S){j.17(0,1).P(h.G);y=0}4($.31.2b)z.2b()}6{2T:3(d,q){2r();w=d;1m=q;2f()},2u:3(){S(1)},2y:3(){S(-1)},2t:3(){4(y!=0&&y-8<0){S(-y)}A{S(-8)}},2s:3(){4(y!=j.1b()-1&&y+8>j.1b()){S(j.1b()-1-y)}A{S(8)}},U:3(){F&&F.U();j&&j.1e(h.G);y=-1},L:3(){6 F&&F.3i(":L")},3h:3(){6 I.L()&&(j.2a("."+h.G)[0]||e.1S&&j[0])},1W:3(){5 a=$(g).3g();F.T({E:Y e.E=="1w"||e.E>0?e.E:$(g).E(),2E:a.2E+g.1i,1Q:a.1Q}).1W();4(e.1x){z.1c(0);z.T({29:e.1s,3e:\'3d\'});4($.1T.3b&&Y 2p.2n.3T.29==="3a"){5 c=0;j.K(3(){c+=I.1i});5 b=c>e.1s;z.T(\'3V\',b?e.1s:c);4(!b){j.E(z.E()-28(j.T("32-1Q"))-28(j.T("32-39")))}}}},26:3(){5 a=j&&j.2a("."+h.G).1e(h.G);6 a&&a.7&&$.w(a[0],"2c")},2J:3(){z&&z.2B()},1u:3(){F&&F.37()}}};$.D.1N=3(b,a,c){4(b.2O){5 d=b.2O();d.36(C);d.35("2P",a);d.4c("2P",c);d.4b()}A 4(b.2Y){b.2Y(a,c)}A{4(b.2X){b.2X=a;b.4a=c}}b.1G()}})(49);',62,261,'|||function|if|var|return|length|||||||||||||||||||||||||data||active|list|else|false|true|Autocompleter|width|element|ACTIVE|value|this|val|each|visible|result|break|toLowerCase|addClass|case|multipleSeparator|moveSelect|css|hide|target|onChange|bind|typeof|max||url|autocomplete||null|trigger|for|slice|flush|multiple|matchSubset|size|scrollTop|preventDefault|removeClass|populate|trimWords|add|offsetHeight|cacheLength|lastWord|hideResultsNow|term|arguments|extend|trim|formatMatch|parse|scrollHeight|highlight|unbind|formatResult|string|scroll|search|mouseDownOnSelect|autoFill|stopLoading|matchCase|delay|new|li|focus|setTimeout|clearTimeout|appendTo|formatItem|defaults|needsInit|Selection|push|continue|left|request|selectFirst|browser|selectCurrent|matchContains|show|unautocomplete|setOptions|split|flushCache|loadingClass|minChars|findValueCallback|inputClass||selected||parseInt|maxHeight|filter|bgiframe|ac_data|COMMA|BACKSPACE|fillList|limitNumberOfItems|movePosition|click|PAGEUP|hideResults|LI|nodeName|body|PAGEDOWN|document|ESC|init|pageDown|pageUp|next|RETURN|nullData|TAB|prev|strong|gi|empty|replace|DEL|top|keyCode|in|resultsClass|DOWN|emptyList|form|opera|dataType|UP|createTextRange|character|Select|extraParams|load|display|mustMatch|receiveData|Cache|selectionStart|setSelectionRange|join|ol|fn|padding|||moveStart|collapse|remove||right|undefined|msie|off|auto|overflow|attr|offset|current|is|find|ac_odd|ac_even|html|innerHeight|clientHeight|parentNode|tagName|while|mouseup|mousedown|index|blur|toUpperCase|188|mouseover|ul|default|absolute|position|div|ac_over|substr|charAt|indexOf|180|RegExp|100|switch|400|keydown|ac_loading|ac_results|keypress|ac_input|submit|style|150|height|success|limit|name|port||abort|mode|ajax|Date|timestamp||200|substring|jQuery|selectionEnd|select|moveEnd'.split('|'),0,{}))



/*

 * jQuery UI Accordion 1.6

 * 

 * Copyright (c) 2007 Jörn Zaefferer

 *

 * http://docs.jquery.com/UI/Accordion

 *

 * Dual licensed under the MIT and GPL licenses:

 *   http://www.opensource.org/licenses/mit-license.php

 *   http://www.gnu.org/licenses/gpl.html

 *

 * Revision: $Id: jquery.accordion.js 6829 2008-12-23 12:35:07Z newonder $

 *

 */



;(function($) {

	

// If the UI scope is not available, add it

$.ui = $.ui || {};



$.fn.extend({

	accordion: function(options, data) {

		var args = Array.prototype.slice.call(arguments, 1);



		return this.each(function() {

			if (typeof options == "string") {

				var accordion = $.data(this, "ui-accordion");

				accordion[options].apply(accordion, args);

			// INIT with optional options

			} else if (!$(this).is(".ui-accordion"))

				$.data(this, "ui-accordion", new $.ui.accordion(this, options));

		});

	},

	// deprecated, use accordion("activate", index) instead

	activate: function(index) {

		return this.accordion("activate", index);

	}

});



$.ui.accordion = function(container, options) {

	

	// setup configuration

	this.options = options = $.extend({}, $.ui.accordion.defaults, options);

	this.element = container;

	

	$(container).addClass("ui-accordion");

	

	if ( options.navigation ) {

		var current = $(container).find("a").filter(options.navigationFilter);

		if ( current.length ) {

			if ( current.filter(options.header).length ) {

				options.active = current;

			} else {

				options.active = current.parent().parent().prev();

				current.addClass("current");

			}

		}

	}

	

	// calculate active if not specified, using the first header

	options.headers = $(container).find(options.header);

	options.active = findActive(options.headers, options.active);



	if ( options.fillSpace ) {

		var maxHeight = $(container).parent().height();

		options.headers.each(function() {

			maxHeight -= $(this).outerHeight();

		});

		var maxPadding = 0;

		options.headers.next().each(function() {

			maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());

		}).height(maxHeight - maxPadding);

	} else if ( options.autoheight ) {

		var maxHeight = 0;

		options.headers.next().each(function() {

			maxHeight = Math.max(maxHeight, $(this).outerHeight());

		}).height(maxHeight);

	}



	options.headers

		.not(options.active || "")

		.next()

		.hide();

	options.active.parent().andSelf().addClass(options.selectedClass);

	

	if (options.event)

		$(container).bind((options.event) + ".ui-accordion", clickHandler);

};



$.ui.accordion.prototype = {

	activate: function(index) {

		// call clickHandler with custom event

		clickHandler.call(this.element, {

			target: findActive( this.options.headers, index )[0]

		});

	},

	

	enable: function() {

		this.options.disabled = false;

	},

	disable: function() {

		this.options.disabled = true;

	},

	destroy: function() {

		this.options.headers.next().css("display", "");

		if ( this.options.fillSpace || this.options.autoheight ) {

			this.options.headers.next().css("height", "");

		}

		$.removeData(this.element, "ui-accordion");

		$(this.element).removeClass("ui-accordion").unbind(".ui-accordion");

	}

}



function scopeCallback(callback, scope) {

	return function() {

		return callback.apply(scope, arguments);

	};

}



function completed(cancel) {

	// if removed while animated data can be empty

	if (!$.data(this, "ui-accordion"))

		return;

	var instance = $.data(this, "ui-accordion");

	var options = instance.options;

	options.running = cancel ? 0 : --options.running;

	if ( options.running )

		return;

	if ( options.clearStyle ) {

		options.toShow.add(options.toHide).css({

			height: "",

			overflow: ""

		});

	}

	$(this).triggerHandler("change.ui-accordion", [options.data], options.change);

}



function toggle(toShow, toHide, data, clickedActive, down) {

	var options = $.data(this, "ui-accordion").options;

	options.toShow = toShow;

	options.toHide = toHide;

	options.data = data;

	var complete = scopeCallback(completed, this);

	

	// count elements to animate

	options.running = toHide.size() == 0 ? toShow.size() : toHide.size();

	

	if ( options.animated ) {

		if ( !options.alwaysOpen && clickedActive ) {

			$.ui.accordion.animations[options.animated]({

				toShow: jQuery([]),

				toHide: toHide,

				complete: complete,

				down: down,

				autoheight: options.autoheight

			});

		} else {

			$.ui.accordion.animations[options.animated]({

				toShow: toShow,

				toHide: toHide,

				complete: complete,

				down: down,

				autoheight: options.autoheight

			});

		}

	} else {

		if ( !options.alwaysOpen && clickedActive ) {

			toShow.toggle();

		} else {

			toHide.hide();

			toShow.show();

		}

		complete(true);

	}

}



function clickHandler(event) {

	var options = $.data(this, "ui-accordion").options;

	if (options.disabled)

		return false;

	

	// called only when using activate(false) to close all parts programmatically

	if ( !event.target && !options.alwaysOpen ) {

		options.active.parent().andSelf().toggleClass(options.selectedClass);

		var toHide = options.active.next(),

			data = {

				instance: this,

				options: options,

				newHeader: jQuery([]),

				oldHeader: options.active,

				newContent: jQuery([]),

				oldContent: toHide

			},

			toShow = options.active = $([]);

		toggle.call(this, toShow, toHide, data );

		return false;

	}

	// get the click target

	var clicked = $(event.target);

	

	// due to the event delegation model, we have to check if one

	// of the parent elements is our actual header, and find that

	if ( clicked.parents(options.header).length )

		while ( !clicked.is(options.header) )

			clicked = clicked.parent();

	

	var clickedActive = clicked[0] == options.active[0];

	

	// if animations are still active, or the active header is the target, ignore click

	if (options.running || (options.alwaysOpen && clickedActive))

		return false;

	if (!clicked.is(options.header))

		return;



	// switch classes

	options.active.parent().andSelf().toggleClass(options.selectedClass);

	if ( !clickedActive ) {

		clicked.parent().andSelf().addClass(options.selectedClass);

	}



	// find elements to show and hide

	var toShow = clicked.next(),

		toHide = options.active.next(),

		//data = [clicked, options.active, toShow, toHide],

		data = {

			instance: this,

			options: options,

			newHeader: clicked,

			oldHeader: options.active,

			newContent: toShow,

			oldContent: toHide

		},

		down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );

	

	options.active = clickedActive ? $([]) : clicked;

	toggle.call(this, toShow, toHide, data, clickedActive, down );



	return false;

};



function findActive(headers, selector) {

	return selector != undefined

		? typeof selector == "number"

			? headers.filter(":eq(" + selector + ")")

			: headers.not(headers.not(selector))

		: selector === false

			? $([])

			: headers.filter(":eq(0)");

}



$.extend($.ui.accordion, {

	defaults: {

		selectedClass: "selected",

		alwaysOpen: true,

		animated: 'slide',

		event: "click",

		header: "a",

		autoheight: true,

		running: 0,

		navigationFilter: function() {

			return this.href.toLowerCase() == location.href.toLowerCase();

		}

	},

	animations: {

		slide: function(options, additions) {

			options = $.extend({

				easing: "swing",

				duration: 300

			}, options, additions);

			if ( !options.toHide.size() ) {

				options.toShow.animate({height: "show"}, options);

				return;

			}

			var hideHeight = options.toHide.height(),

				showHeight = options.toShow.height(),

				difference = showHeight / hideHeight;

			options.toShow.css({ height: 0, overflow: 'hidden' }).show();

			options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{

				step: function(now) {

					var current = (hideHeight - now) * difference;

					if ($.browser.msie || $.browser.opera) {

						current = Math.ceil(current);

					}

					options.toShow.height( current );

				},

				duration: options.duration,

				easing: options.easing,

				complete: function() {

					if ( !options.autoheight ) {

						options.toShow.css("height", "auto");

					}

					options.complete();

				}

			});

		},

		bounceslide: function(options) {

			this.slide(options, {

				easing: options.down ? "bounceout" : "swing",

				duration: options.down ? 1000 : 200

			});

		},

		easeslide: function(options) {

			this.slide(options, {

				easing: "easeinout",

				duration: 700

			})

		}

	}

});



})(jQuery);




/*

 * jQuery Form Plugin

 * version: 2.16 (17-OCT-2008)

 * @requires jQuery v1.2.2 or later

 *

 * Examples and documentation at: http://malsup.com/jquery/form/

 * Dual licensed under the MIT and GPL licenses:

 *   http://www.opensource.org/licenses/mit-license.php

 *   http://www.gnu.org/licenses/gpl.html

 *

 * Revision: $Id: jquery.form.js 6829 2008-12-23 12:35:07Z newonder $

 */

;(function($) {



/*

    Usage Note:  

    -----------

    Do not use both ajaxSubmit and ajaxForm on the same form.  These

    functions are intended to be exclusive.  Use ajaxSubmit if you want

    to bind your own submit handler to the form.  For example,



    $(document).ready(function() {

        $('#myForm').bind('submit', function() {

            $(this).ajaxSubmit({

                target: '#output'

            });

            return false; // <-- important!

        });

    });



    Use ajaxForm when you want the plugin to manage all the event binding

    for you.  For example,



    $(document).ready(function() {

        $('#myForm').ajaxForm({

            target: '#output'

        });

    });

        

    When using ajaxForm, the ajaxSubmit function will be invoked for you

    at the appropriate time.  

*/



/**

 * ajaxSubmit() provides a mechanism for immediately submitting 

 * an HTML form using AJAX.

 */

$.fn.ajaxSubmit = function(options) {

    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)

    if (!this.length) {

        log('ajaxSubmit: skipping submit process - no element selected');

        return this;

    }



    if (typeof options == 'function')

        options = { success: options };



    options = $.extend({

        url:  this.attr('action') || window.location.toString(),

        type: this.attr('method') || 'GET'

    }, options || {});



    // hook for manipulating the form data before it is extracted;

    // convenient for use with rich editors like tinyMCE or FCKEditor

    var veto = {};

    this.trigger('form-pre-serialize', [this, options, veto]);

    if (veto.veto) {

        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');

        return this;

   }



    var a = this.formToArray(options.semantic);

    if (options.data) {

        options.extraData = options.data;

        for (var n in options.data) {

          if(options.data[n] instanceof Array) {

            for (var k in options.data[n])

              a.push( { name: n, value: options.data[n][k] } )

          }  

          else

             a.push( { name: n, value: options.data[n] } );

        }

    }



    // give pre-submit callback an opportunity to abort the submit

    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {

        log('ajaxSubmit: submit aborted via beforeSubmit callback');

        return this;

    }    



    // fire vetoable 'validate' event

    this.trigger('form-submit-validate', [a, this, options, veto]);

    if (veto.veto) {

        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');

        return this;

    }    



    var q = $.param(a);



    if (options.type.toUpperCase() == 'GET') {

        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;

        options.data = null;  // data is null for 'get'

    }

    else

        options.data = q; // data is the query string for 'post'



    var $form = this, callbacks = [];

    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });

    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });



    // perform a load on the target only if dataType is not provided

    if (!options.dataType && options.target) {

        var oldSuccess = options.success || function(){};

        callbacks.push(function(data) {

            $(options.target).html(data).each(oldSuccess, arguments);

        });

    }

    else if (options.success)

        callbacks.push(options.success);



    options.success = function(data, status) {

        for (var i=0, max=callbacks.length; i < max; i++)

            callbacks[i].apply(options, [data, status, $form]);

    };



    // are there files to upload?

    var files = $('input:file', this).fieldValue();

    var found = false;

    for (var j=0; j < files.length; j++)

        if (files[j])

            found = true;



    // options.iframe allows user to force iframe mode

   if (options.iframe || found) { 

       // hack to fix Safari hang (thanks to Tim Molendijk for this)

       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d

       if ($.browser.safari && options.closeKeepAlive)

           $.get(options.closeKeepAlive, fileUpload);

       else

           fileUpload();

       }

   else

       $.ajax(options);



    // fire 'notify' event

    this.trigger('form-submit-notify', [this, options]);

    return this;





    // private function for handling file uploads (hat tip to YAHOO!)

    function fileUpload() {

        var form = $form[0];

        

        if ($(':input[@name=submit]', form).length) {

            alert('Error: Form elements must not be named "submit".');

            return;

        }

        

        var opts = $.extend({}, $.ajaxSettings, options);

		var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);



        var id = 'jqFormIO' + (new Date().getTime());

        var $io = $('<iframe id="' + id + '" name="' + id + '" />');

        var io = $io[0];



        if ($.browser.msie || $.browser.opera) 

            io.src = 'javascript:false;document.write("");';

        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });



        var xhr = { // mock object

            aborted: 0,

            responseText: null,

            responseXML: null,

            status: 0,

            statusText: 'n/a',

            getAllResponseHeaders: function() {},

            getResponseHeader: function() {},

            setRequestHeader: function() {},

            abort: function() { 

                this.aborted = 1; 

                $io.attr('src','about:blank'); // abort op in progress

            }

        };



        var g = opts.global;

        // trigger ajax global events so that activity/block indicators work like normal

        if (g && ! $.active++) $.event.trigger("ajaxStart");

        if (g) $.event.trigger("ajaxSend", [xhr, opts]);



		if (s.beforeSend && s.beforeSend(xhr, s) === false) {

			s.global && jQuery.active--;

			return;

        }

        if (xhr.aborted)

            return;

        

        var cbInvoked = 0;

        var timedOut = 0;



        // add submitting element to data if we know it

        var sub = form.clk;

        if (sub) {

            var n = sub.name;

            if (n && !sub.disabled) {

                options.extraData = options.extraData || {};

                options.extraData[n] = sub.value;

                if (sub.type == "image") {

                    options.extraData[name+'.x'] = form.clk_x;

                    options.extraData[name+'.y'] = form.clk_y;

                }

            }

        }



        // take a breath so that pending repaints get some cpu time before the upload starts

        setTimeout(function() {

            // make sure form attrs are set

            var t = $form.attr('target'), a = $form.attr('action');

            $form.attr({

                target:   id,

                method:   'POST',

                action:   opts.url

            });

            

            // ie borks in some cases when setting encoding

            if (! options.skipEncodingOverride) {

                $form.attr({

                    encoding: 'multipart/form-data',

                    enctype:  'multipart/form-data'

                });

            }



            // support timout

            if (opts.timeout)

                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);



            // add "extra" data to form if provided in options

            var extraInputs = [];

            try {

                if (options.extraData)

                    for (var n in options.extraData)

                        extraInputs.push(

                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')

                                .appendTo(form)[0]);

            

                // add iframe to doc and submit the form

                $io.appendTo('body');

                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);

                form.submit();

            }

            finally {

                // reset attrs and remove "extra" input elements

                $form.attr('action', a);

                t ? $form.attr('target', t) : $form.removeAttr('target');

                $(extraInputs).remove();

            }

        }, 10);



        function cb() {

            if (cbInvoked++) return;

            

            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);



            var operaHack = 0;

            var ok = true;

            try {

                if (timedOut) throw 'timeout';

                // extract the server response from the iframe

                var data, doc;



                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;

                

                if (doc.body == null && !operaHack && $.browser.opera) {

                    // In Opera 9.2.x the iframe DOM is not always traversable when

                    // the onload callback fires so we give Opera 100ms to right itself

                    operaHack = 1;

                    cbInvoked--;

                    setTimeout(cb, 100);

                    return;

                }

                

                xhr.responseText = doc.body ? doc.body.innerHTML : null;

                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;

                xhr.getResponseHeader = function(header){

                    var headers = {'content-type': opts.dataType};

                    return headers[header];

                };



                if (opts.dataType == 'json' || opts.dataType == 'script') {

                    var ta = doc.getElementsByTagName('textarea')[0];

                    xhr.responseText = ta ? ta.value : xhr.responseText;

                }

                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {

                    xhr.responseXML = toXml(xhr.responseText);

                }

                data = $.httpData(xhr, opts.dataType);

            }

            catch(e){

                ok = false;

                $.handleError(opts, xhr, 'error', e);

            }



            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it

            if (ok) {

                opts.success(data, 'success');

                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);

            }

            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);

            if (g && ! --$.active) $.event.trigger("ajaxStop");

            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');



            // clean up

            setTimeout(function() {

                $io.remove();

                xhr.responseXML = null;

            }, 100);

        };



        function toXml(s, doc) {

            if (window.ActiveXObject) {

                doc = new ActiveXObject('Microsoft.XMLDOM');

                doc.async = 'false';

                doc.loadXML(s);

            }

            else

                doc = (new DOMParser()).parseFromString(s, 'text/xml');

            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;

        };

    };

};



/**

 * ajaxForm() provides a mechanism for fully automating form submission.

 *

 * The advantages of using this method instead of ajaxSubmit() are:

 *

 * 1: This method will include coordinates for <input type="image" /> elements (if the element

 *    is used to submit the form).

 * 2. This method will include the submit element's name/value data (for the element that was

 *    used to submit the form).

 * 3. This method binds the submit() method to the form for you.

 *

 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely

 * passes the options argument along after properly binding events for submit elements and

 * the form itself.

 */ 

$.fn.ajaxForm = function(options) {

    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {

        $(this).ajaxSubmit(options);

        return false;

    }).each(function() {

        // store options in hash

        $(":submit,input:image", this).bind('click.form-plugin',function(e) {

            var form = this.form;

            form.clk = this;

            if (this.type == 'image') {

                if (e.offsetX != undefined) {

                    form.clk_x = e.offsetX;

                    form.clk_y = e.offsetY;

                } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin

                    var offset = $(this).offset();

                    form.clk_x = e.pageX - offset.left;

                    form.clk_y = e.pageY - offset.top;

                } else {

                    form.clk_x = e.pageX - this.offsetLeft;

                    form.clk_y = e.pageY - this.offsetTop;

                }

            }

            // clear form vars

            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);

        });

    });

};



// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm

$.fn.ajaxFormUnbind = function() {

    this.unbind('submit.form-plugin');

    return this.each(function() {

        $(":submit,input:image", this).unbind('click.form-plugin');

    });



};



/**

 * formToArray() gathers form element data into an array of objects that can

 * be passed to any of the following ajax functions: $.get, $.post, or load.

 * Each object in the array has both a 'name' and 'value' property.  An example of

 * an array for a simple login form might be:

 *

 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]

 *

 * It is this array that is passed to pre-submit callback functions provided to the

 * ajaxSubmit() and ajaxForm() methods.

 */

$.fn.formToArray = function(semantic) {

    var a = [];

    if (this.length == 0) return a;



    var form = this[0];

    var els = semantic ? form.getElementsByTagName('*') : form.elements;

    if (!els) return a;

    for(var i=0, max=els.length; i < max; i++) {

        var el = els[i];

        var n = el.name;

        if (!n) continue;



        if (semantic && form.clk && el.type == "image") {

            // handle image inputs on the fly when semantic == true

            if(!el.disabled && form.clk == el)

                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});

            continue;

        }



        var v = $.fieldValue(el, true);

        if (v && v.constructor == Array) {

            for(var j=0, jmax=v.length; j < jmax; j++)

                a.push({name: n, value: v[j]});

        }

        else if (v !== null && typeof v != 'undefined')

            a.push({name: n, value: v});

    }



    if (!semantic && form.clk) {

        // input type=='image' are not found in elements array! handle them here

        var inputs = form.getElementsByTagName("input");

        for(var i=0, max=inputs.length; i < max; i++) {

            var input = inputs[i];

            var n = input.name;

            if(n && !input.disabled && input.type == "image" && form.clk == input)

                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});

        }

    }

    return a;

};



/**

 * Serializes form data into a 'submittable' string. This method will return a string

 * in the format: name1=value1&amp;name2=value2

 */

$.fn.formSerialize = function(semantic) {

    //hand off to jQuery.param for proper encoding

    return $.param(this.formToArray(semantic));

};



/**

 * Serializes all field elements in the jQuery object into a query string.

 * This method will return a string in the format: name1=value1&amp;name2=value2

 */

$.fn.fieldSerialize = function(successful) {

    var a = [];

    this.each(function() {

        var n = this.name;

        if (!n) return;

        var v = $.fieldValue(this, successful);

        if (v && v.constructor == Array) {

            for (var i=0,max=v.length; i < max; i++)

                a.push({name: n, value: v[i]});

        }

        else if (v !== null && typeof v != 'undefined')

            a.push({name: this.name, value: v});

    });

    //hand off to jQuery.param for proper encoding

    return $.param(a);

};



/**

 * Returns the value(s) of the element in the matched set.  For example, consider the following form:

 *

 *  <form><fieldset>

 *      <input name="A" type="text" />

 *      <input name="A" type="text" />

 *      <input name="B" type="checkbox" value="B1" />

 *      <input name="B" type="checkbox" value="B2"/>

 *      <input name="C" type="radio" value="C1" />

 *      <input name="C" type="radio" value="C2" />

 *  </fieldset></form>

 *

 *  var v = $(':text').fieldValue();

 *  // if no values are entered into the text inputs

 *  v == ['','']

 *  // if values entered into the text inputs are 'foo' and 'bar'

 *  v == ['foo','bar']

 *

 *  var v = $(':checkbox').fieldValue();

 *  // if neither checkbox is checked

 *  v === undefined

 *  // if both checkboxes are checked

 *  v == ['B1', 'B2']

 *

 *  var v = $(':radio').fieldValue();

 *  // if neither radio is checked

 *  v === undefined

 *  // if first radio is checked

 *  v == ['C1']

 *

 * The successful argument controls whether or not the field element must be 'successful'

 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).

 * The default value of the successful argument is true.  If this value is false the value(s)

 * for each element is returned.

 *

 * Note: This method *always* returns an array.  If no valid value can be determined the

 *       array will be empty, otherwise it will contain one or more values.

 */

$.fn.fieldValue = function(successful) {

    for (var val=[], i=0, max=this.length; i < max; i++) {

        var el = this[i];

        var v = $.fieldValue(el, successful);

        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))

            continue;

        v.constructor == Array ? $.merge(val, v) : val.push(v);

    }

    return val;

};



/**

 * Returns the value of the field element.

 */

$.fieldValue = function(el, successful) {

    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();

    if (typeof successful == 'undefined') successful = true;



    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||

        (t == 'checkbox' || t == 'radio') && !el.checked ||

        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||

        tag == 'select' && el.selectedIndex == -1))

            return null;



    if (tag == 'select') {

        var index = el.selectedIndex;

        if (index < 0) return null;

        var a = [], ops = el.options;

        var one = (t == 'select-one');

        var max = (one ? index+1 : ops.length);

        for(var i=(one ? index : 0); i < max; i++) {

            var op = ops[i];

            if (op.selected) {

                // extra pain for IE...

                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;

                if (one) return v;

                a.push(v);

            }

        }

        return a;

    }

    return el.value;

};



/**

 * Clears the form data.  Takes the following actions on the form's input fields:

 *  - input text fields will have their 'value' property set to the empty string

 *  - select elements will have their 'selectedIndex' property set to -1

 *  - checkbox and radio inputs will have their 'checked' property set to false

 *  - inputs of type submit, button, reset, and hidden will *not* be effected

 *  - button elements will *not* be effected

 */

$.fn.clearForm = function() {

    return this.each(function() {

        $('input,select,textarea', this).clearFields();

    });

};



/**

 * Clears the selected form elements.

 */

$.fn.clearFields = $.fn.clearInputs = function() {

    return this.each(function() {

        var t = this.type, tag = this.tagName.toLowerCase();

        if (t == 'text' || t == 'password' || tag == 'textarea')

            this.value = '';

        else if (t == 'checkbox' || t == 'radio')

            this.checked = false;

        else if (tag == 'select')

            this.selectedIndex = -1;

    });

};



/**

 * Resets the form data.  Causes all form elements to be reset to their original value.

 */

$.fn.resetForm = function() {

    return this.each(function() {

        // guard against an input with the name of 'reset'

        // note that IE reports the reset function as an 'object'

        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))

            this.reset();

    });

};



/**

 * Enables or disables any matching elements.

 */

$.fn.enable = function(b) { 

    if (b == undefined) b = true;

    return this.each(function() { 

        this.disabled = !b 

    });

};



/**

 * Checks/unchecks any matching checkboxes or radio buttons and

 * selects/deselects and matching option elements.

 */

$.fn.selected = function(select) {

    if (select == undefined) select = true;

    return this.each(function() { 

        var t = this.type;

        if (t == 'checkbox' || t == 'radio')

            this.checked = select;

        else if (this.tagName.toLowerCase() == 'option') {

            var $sel = $(this).parent('select');

            if (select && $sel[0] && $sel[0].type == 'select-one') {

                // deselect all other options

                $sel.find('option').selected(false);

            }

            this.selected = select;

        }

    });

};



// helper fn for console logging

// set $.fn.ajaxSubmit.debug to true to enable debug logging

function log() {

    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)

        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));

};



})(jQuery);




$(document).ready(function() {



	// Attach jquery iu datepicker to corresponding object managing form fields

	$('form.object_form input.datetime_date').datepicker(

		// $.datepicker.regional["ru"],

		 {

		mandatory:		true,

		highlightWeek:	true,

		defaultDate:	'+1d',

//		defaultDate:	new Date(1982,0,1),

		dateFormat:		'yy-mm-dd',

		yearRange: 		'1900:2020'

	});	



	// Prepare object managing form for submitting

	$('form.object_form').submit(function() {

		// Create hidden field with 0 value for each unchecked checkbox in object forms

		var checkboxes = $('input:checkbox', this);

		checkboxes.each( function(i) {

			if (!this.checked) {

				$(this.form).append( '<input type="hidden" name="' + this.name + '" value="0"/>' );

			};

		});

		

		// combine date & time values in single hidden field for datetimes

		var datetime_hiddens = $('input.datetime_hidden', this);

		datetime_hiddens.each( function(i) {

			var date	= $('.datetime_date', $(this).parent().get(0)).get(0).value;

			var time	= $('.datetime_time', $(this).parent().get(0)).get(0).value;

			

			if( date == '' ) {

				this.value	= '';

			} else {			

				if( /^(0|1|2|3|4|5)\d:(0|1|2|3|4|5)\d$/.test( time ) ) {

					time += ':00';

				}

				this.value	= date + ' ' + time;

			}

		});

		

		// Disable submits

		$('.object_form input:submit').attr("disabled","disabled");

		

		return true;

	});

	

});




function provider(u, s, l) {

  this.url = u;

  this.start = s;

  this.length = l;

}



var table = new Object;

table['1'] = new provider('http://username.blogspot.com/', 7, 8);

table['2'] = new provider('http://username.livejournal.com/', 7, 8);

table['3'] = new provider('http://id.rambler.ru/users/username/', 27, 8);

table['4'] = new provider('http://openid.yandex.ru/users/username/', 30, 8);

table['5'] = new provider('http://www.liveinternet.ru/users/username/', 33, 8);



/**

 * Show transfer lepts popup 

 */

function transfer_lepts(uid, display_name) {

	if (uid) {

		$('#ul_member_id').val(uid);

	}

	if (display_name) {

		$('#pay_name').val(display_name);

	}

	$('#alert ul li').hide();

	$('#alert ul li.user-lepts').show();

	$('#alert').show();

	$('#screen').show();

}





$(document).ready(function(){

	//dzhi menu-accordion

	$('#bayan').accordion({

		autoheight: false,

		active: '.active', 

		header: '.head', 

		navigation: true, 

		event: 'mouseover'

	});



	// add volonters (action)

	$('#add_volonter').click(function(){

		$(this).next("div").slideToggle("fast");

	});

	// past in blog (action)

	$('a.paste-in-blog').click(function(){

		$(this).nextAll("div.paste-in-blog-link").slideToggle("fast");

		return false;

	});

	// to agree (bank)

	$('.agree').click(function(){

		if( ! $('body').hasClass('user-not-logged-in') ) {

		  $(this).nextAll("div.agree-message").slideToggle("fast");

		}

		return false;

	});



	$('.message-answer-form').submit(function(){

		$(this).ajaxSubmit({

			type: 'POST',

		    dataType: 'json',

		    success: function(data) {

			  alert(data.message);

		      if(data.status == 'success') {

				$('.message-answer-form').clearForm();

				$('div.agree-message').hide();

			  }

			}

		});

		return false;

	});

  

	

	

	// search form

	$(function() {

		swapValues = [];

		$(".swap-search-value").each(function(i){

			swapValues[i] = $(this).val();

			$(this).focus(function(){

				if ($(this).val() == swapValues[i]) {

					$(this).val("");

				}

			}).blur(function(){

				if ($.trim($(this).val()) == "") {

					$(this).val(swapValues[i]);

				}

			});

		});

	});

	



	// for IE6

    $('<div class="screen-inner"></div>').css('width', '100%').css('height', '100%').css('position', 'relative').appendTo('#screen');

    

    /* Alerts logic */

    $('#screen div.screen-inner, #alert a.close-button').click(function(){

        $('#alert').hide();

		$('#screen').hide();

        return false;

    });

	$('#screen div.screen-inner, #alert img.close-button').click(function(){

        $('#alert').hide();

		$('#screen').hide();

        return false;

    });

    

    $('#user-whats-lepta, #user-subscribe, #user-require-login-comments').click(function(){

        //$('#alert').css('backgroundImage', 'url(/i/ui/bg-alert.jpg)');

        $('#alert ul li').hide();

        if ($(this).attr('id').indexOf('user-') != 0)

            $('#alert ul li.' + $(this).parent().attr('id')).show();

        else

            $('#alert ul li.' + $(this).attr('id')).show();

        $('#screen').show();

        $('#alert').show();

		$('#alert a.close-button').css('display', 'block');

		$('#alert').css('left', '50%');

		

		

		$('#alert ul li.user-whats-lepta ul li').show();

		$('#alert ul li.user-whats-lepta ul li').css('list-style-type', 'disc');

		

        return false;

    });

    



    $('.user-send-bill-link').click(function(){

		$('#alert ul li').hide();

        $('#alert ul li.user-send-bill').css({display: 'block'});

        $('#alert ul li.user-send-bill').show;

        $('#alert ul li.user-send-bill form').attr('action', $(this).attr('href'));

        $('#screen').show();

        $('#alert').show();

        return false;

    });



	$('.prepare-send-lepts-form').click(function(){

		$('#alert ul li').hide();

        $('#alert ul li.user-lepts').css({display: 'block'});

        $('#alert ul li.user-lepts').show();

        $('#pay_name').val($(this).find('span.login').text());

        $('#pay_amount').val($(this).find('span.amount').text());

        $('#pay_description').val($(this).find('span.description').text());

        $('#screen').show();

        $('#alert').show();

        return false;

    });



	$('body.user-not-logged-in .require-login').click(function(){

        //$('#alert ul li').hide();

        //$('#alert ul li.user-wellcome, #screen, #alert').show();

		document.location.href = '/login';

		return false;

    });



	$('.projects .support').click(function(){

		$('#alert ul li, #alert a.close-button').hide();

        $('#alert ul li.vote-for-project, #alert ul li.vote-for-project li, #screen, #alert').show();

		return false;

    });









    /* OpenID logic */

    $('#openid').click(function(){

        $('.auth_error').text('');

        $('.auth_error').css("display","none");

        $('#alert ul li.user-wellcome>div').animate({marginLeft: '-270px'} , 400);

    });

	    $('#to-registration').click(function(){

        $('#alert ul li.user-wellcome>div').animate({marginLeft: '270px'} , 400);

    });

    $('#not-openid').click(function(){

    	$('.auth_error').text('');

        $('.auth_error').css("display","none");

        $('#alert ul li.user-wellcome>div').animate({marginLeft: '0'} , 400);

    });

    // $('#alert li.user-wellcome div.links-section a').click(setOpenID);

    $('.openid-selector a').click(setOpenID);

	

	

	/* user-panel-registration Show-Hide OpenId and Change Password */

    

	$('h2#profile-edit-openid').click(function(){

        $('form#profile-edit-openid-form').slideToggle("fast");

    });

    $('h2#profile-edit-password').click(function(){

        $('form#profile-edit-password-form').slideToggle("fast");

    });	

	

/**

 * Открываем все внешние ссылки в новом табе

 */

var links = $('A:not([target=_blank])');

for (var i=0; i<links.length; i++) {

	if (links[i] && links[i].href && $(links[i]).attr('href').indexOf('http://') == 0 && $(links[i]).attr('href').indexOf('http://cw.ru/') != 0) {

		links[i].target = '_blank';

	}

}

	

});



function setOpenID() {

	var type = $(this).attr('href').substr(1);

  // var field = document.getElementById('login_openid');

  var field = $(this).parent().parent().find('input[name="openid_identifier"]').get(0);

	

	if ( typeof( table[type] ) != 'undefined' )

	{

		field.value = table[type].url;

		

		var start = table[type].start;

		var end   = table[type].start+table[type].length;

		if(field.setSelectionRange) {

			field.setSelectionRange(start,end);

		}

		else if (field.createTextRange) {

			var range = field.createTextRange();

			range.collapse(true);

			range.moveEnd('character', end);

			range.moveStart('character', start);

			range.select();

		}

	}

	field.focus();

	

	return false;

}







function getyScroll()

{

   yScroll = 0;

   if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX)

   {

        yScroll = window.innerHeight + window.scrollMaxY;

        xScroll = window.innerWidth + window.scrollMaxX;



        var deff = document.documentElement;

        var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;

        var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;



        xScroll -= (window.innerWidth - wff);

        yScroll -= (window.innerHeight - hff);

   } 

   else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth)

   { // all but Explorer Mac

        yScroll = document.body.scrollHeight;

        xScroll = document.body.scrollWidth;

   } 

   else 

   { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

        yScroll = document.body.offsetHeight;

        xScroll = document.body.offsetWidth;

   }

   return yScroll;

}



function openWin(wUri, wName, wWidth, wHeight, Scroll, wMenu) {

		var scrollBars = (Scroll!=0) ? 1 : 0;

		var scrollBars = 0;

		var menuBars = (wMenu) ? 1 : 0;

		var positionLeft = (screen.width - wWidth)/2;

		var positionTop = (screen.height - wHeight)/2;

		var myW = window.open(wUri,'','width='+wWidth+',height='+wHeight+',top='+positionTop+',left='+positionLeft+',location=0,menubar='+menuBars+',resizable=0,scrollbars='+scrollBars+',status=0,titlebar=0,toolbar=0,directories=0,hotkeys=0');

		myW.focus();

}



function initHoverTabs(tabIdPrefix, viewIdPrefix) {

	var fullPrefix = viewIdPrefix + tabIdPrefix;

	var tabs = $('[id^="' + tabIdPrefix + '"]');

	var select = function (el) {

		$('[id^="' + fullPrefix + '"]').hide();

		$('#' + viewIdPrefix + el.attr('id')).show();

		tabs.removeClass('ui-tabs-selected');

		el.addClass('ui-tabs-selected');

	};



	select($('#' + tabIdPrefix + '1'));



	// use bind, not hover. in some stupid reason hover cause error here...

	tabs.bind('mouseenter', function() {

		select($(this));

	});

}




