/**
 * @author alexander.farkas
 * 
 * @version 2.5.4
 * project site: http://plugins.jquery.com/project/AjaxManager
 */
(function($){
	$.support.ajax = !!(window.XMLHttpRequest);
	if(window.ActiveXObject){
		try{
			new ActiveXObject("Microsoft.XMLHTTP");
			$.support.ajax = true;
		} catch(e){
			if(window.XMLHttpRequest){
				$.ajaxSetup({xhr: function(){
					return new XMLHttpRequest();
				}});
			}
		}
	}
	$.manageAjax = (function(){
		var cache 			= {},
			queues			= {},
			presets 		= {},
			activeRequest 	= {},
			allRequests 	= {},
			triggerEndCache = {},
			defaults 		= {
						queue: true, //clear
						maxRequests: 1,
						abortOld: false,
						preventDoubbleRequests: true,
						cacheResponse: false,
						complete: function(){},
						error: function(ahr, status){
							var opts = this;
							if(status && status.indexOf('error') != -1){
								setTimeout(function(){
									var errStr = status +': ';
									if(ahr.status){
										errStr += 'status: '+ ahr.status +' | ';
									}
									errStr += 'URL: '+ opts.url;
									throw new Error(errStr);
								}, 1);
							}
						},
						success: function(){},
						abort: function(){}
				}
		;
		
		function create(name, settings){
			var publicMethods = {};
			presets[name] = presets[name] ||
				{};
			
			$.extend(true, presets[name], $.ajaxSettings, defaults, settings);
			
			if(!allRequests[name]){
				allRequests[name] 	= {};
				activeRequest[name] = {};
				activeRequest[name].queue = [];
				queues[name] 		= [];
				triggerEndCache[name] = [];
			}
			$.each($.manageAjax, function(fnName, fn){
				if($.isFunction(fn) && fnName.indexOf('_') !== 0){
					publicMethods[fnName] = function(param, param2){
						if(param2 && typeof param === 'string'){
							param = param2;
						}
						fn(name, param);
					};
				}
			});
			return publicMethods;
		}
		
		function complete(opts, args){
			
			if(args[1] == 'success' || args[1] == 'notmodified'){
				opts.success.apply(opts, [args[0].successData, args[1]]);
				if (opts.global) {
					$.event.trigger("ajaxSuccess", args);
				}
			}
			
			if(args[1] === 'abort'){
				opts.abort.apply(opts, args);
				if(opts.global){
					$.active--;
					$.event.trigger("ajaxAbort", args);
				}
			}
			
			opts.complete.apply(opts, args);
			
			if (opts.global) {
				$.event.trigger("ajaxComplete", args);
			}
			
			if (opts.global && ! $.active){
				$.event.trigger("ajaxStop");
			}
			//args[0] = null; 
		}
		
		function proxy(oldFn, fn){
			return function(xhr, s, e){
				fn.call(this, xhr, s, e);
				oldFn.call(this, xhr, s, e);
				xhr = null;
				e = null;
			};
		}
		
					
		function callQueueFn(name){
			var q = queues[name];
			if(q && q.length){
				var fn = q.shift();
				if(fn){
					fn();
				}
			}
		}

		
		function add(name, opts){
			if(!presets[name]){
				create(name, opts);
			}
			opts = $.extend({}, presets[name], opts);
			//aliases
			var allR 	= allRequests[name],
				activeR = activeRequest[name],
				queue	= queues[name];
			
			var id 				= opts.type +'_'+ opts.url.replace(/\./g, '_'),
				triggerStart 	= true,
				oldComplete 	= opts.complete,
				ajaxFn 			= function(){
									activeR.queue.push(id);
									activeR[id] = {
										xhr: false,
										ajaxManagerOpts: opts
									};
									activeR[id].xhr = $.ajax(opts);
									return id;
								}
				;
				
			if(opts.data){
				id += (typeof opts.data == 'string') ? opts.data : $.param(opts.data);
			}
			
			if(opts.preventDoubbleRequests && allRequests[name][id]){
				return false;
			}
			
			allR[id] = true;
			
			opts.complete = function(xhr, s, e){
				var triggerEnd = true;
				if(opts.abortOld){
					$.each(activeR.queue, function(i, activeID){
						if(activeID == id){
							return false;
						}
						abort(name, activeID);
						return activeID;
					});
				}
				oldComplete.call(this, xhr, s, e);
				//stop memory leak
				if(activeRequest[name][id]){
					if(activeRequest[name][id] && activeRequest[name][id].xhr){
						activeRequest[name][id].xhr = null;
					} 
					activeRequest[name][id] = null;
				}
				triggerEndCache[name].push({xhr: xhr, status: s});
				xhr = null;
				activeRequest[name].queue = $.grep(activeRequest[name].queue, function(qid){
					return (qid !== id);
				});
				allR[id] = false;
				
				e = null;
				
				delete activeRequest[name][id];
				
				$.each(activeR, function(id, queueRunning){
					if(id !== 'queue' || queueRunning.length){
						triggerEnd = false;
						return false;
					}
				});
				
				if(triggerEnd){
					$.event.trigger(name +'End', [triggerEndCache[name]]);
					$.each(triggerEndCache[name], function(i, cached){
						cached.xhr = null; //memory leak
					});
					triggerEndCache[name] = [];
				}
			};
			
			if(cache[id]){
				ajaxFn = function(){
					activeR.queue.push(id);
					complete(opts, cache[id]);
					return id;
				};
			} else if(opts.cacheResponse){
				 opts.complete = proxy(opts.complete, function(xhr, s){
					if( s !== "success" && s !== "notmodified" ){
						return false;
					}
					cache[id][0].responseXML 	= xhr.responseXML;
					cache[id][0].responseText 	= xhr.responseText;
					cache[id][1] 				= s;
					//stop memory leak
					xhr = null;
					return id; //strict
				});
				
				opts.success = proxy(opts.success, function(data, s){
					cache[id] = [{
						successData: data,
						ajaxManagerOpts: opts
					}, s];
					data = null;
				});
			}
			
			ajaxFn.ajaxID = id;
			
			$.each(activeR, function(id, queueRunning){
				if(id !== 'queue' || queueRunning.length){
					triggerStart = false;
					return false;
				}
			});
			
			if(triggerStart){
				$.event.trigger(name +'Start');
			}
			if(opts.queue){
				opts.complete = proxy(opts.complete, function(){
					
					callQueueFn(name);
				});
				 
				if(opts.queue === 'clear'){
					queue = clear(name);
				}
				
				queue.push(ajaxFn);
				
				if(activeR.queue.length < opts.maxRequests){
					callQueueFn(name); 
				}
				return id;
			}
			
			
			
			return ajaxFn();
		}
		
		function clear(name, shouldAbort){
			$.each(queues[name], function(i, fn){
				allRequests[name][fn.ajaxID] = false;
			});
			queues[name] = [];
			
			if(shouldAbort){
				abort(name);
			}
			return queues[name];
		}
		
		function getXHR(name, id){
			var ar = activeRequest[name];
			if(!ar || !allRequests[name][id]){
				return false;
			}
			if(ar[id]){
				return ar[id].xhr;
			}
			var queue = queues[name],
				xhrFn;
			$.each(queue, function(i, fn){
				if(fn.ajaxID == id){
					xhrFn = [fn, i];
					return false;
				}
				return xhrFn;
			});
			return xhrFn;
		}
		
		function abort(name, id){
			var ar = activeRequest[name];
			if(!ar){
				return false;
			}
			function abortID(qid){
				if(qid !== 'queue' && ar[qid] && ar[qid].xhr){
					try {
						ar[qid].xhr.abort();
					} catch(e){}
					complete(ar[qid].ajaxManagerOpts, [ar[qid].xhr, 'abort']);
				}
				return null;
			}
			if(id){
				return abortID(id);
			}
			return $.each(ar, abortID);
		}
		
		function unload(){
			$.each(presets, function(name){
				clear(name, true);
			});
			cache = {};
		}
		
		return {
			defaults: 		defaults,
			add: 			add,
			create: 		create,
			cache: 			cache,
			abort: 			abort,
			clear: 			clear,
			getXHR: 		getXHR,
			_activeRequest: activeRequest,
			_complete: 		complete,
			_allRequests: 	allRequests,
			_unload: 		unload
		};
	})();
	//stop memory leaks
	$(window).unload($.manageAjax._unload);
})(jQuery);//jquery.json.js
/*
    based on
    http://www.JSON.org/json2.js
    2008-11-19
    
    jQuery plugin info:
    @author  Jim Dalton (jim.dalton@furrybrains.com)
    @date    1/15/2009
    @version 1.0
    
    Comments below were modified to reflect usage in the context of jQuery. Otherwise
    these comments are identical to the source library.

    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: jQuery.jSONToString
    and jQuery.toJSON.

        jQuery.jSONToString(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 = jQuery.jSONToString(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = jQuery.jSONToString(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

            text = jQuery.jSONToString([new Date()], function (key, value) {
                return this[key] instanceof Date ?
                    'Date(' + this[key] + ')' : value;
            });
            // text is '["Date(---current time---)"]'


        jQuery.toJSON(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 = jQuery.toJSON(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 = jQuery.toJSON('["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.
*/
;(function($) {
    if (!this.JSON) {
        this.JSON = {};
    }
    /*
		    http://www.JSON.org/json2.js
		    2009-09-29
		
		    Public Domain.
		
		    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
		
		    See http://www.JSON.org/js.html
		
		
		    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.
		
		
		    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 value
		
		            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.
		*/
		
		/*jslint evil: true, strict: false */
		
		/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
		    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
		    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
		    lastIndex, length, parse, 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) {
		    this.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 isFinite(this.valueOf()) ?
		                   this.getUTCFullYear()   + '-' +
		                 f(this.getUTCMonth() + 1) + '-' +
		                 f(this.getUTCDate())      + 'T' +
		                 f(this.getUTCHours())     + ':' +
		                 f(this.getUTCMinutes())   + ':' +
		                 f(this.getUTCSeconds())   + 'Z' : null;
		        };
		
		        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,
		        escapable = /[\\\"\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.
		
		        escapable.lastIndex = 0;
		        return escapable.test(string) ?
		            '"' + string.replace(escapable, function (a) {
		                var c = meta[a];
		                return typeof c === 'string' ? c :
		                    '\\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 = [];
		
		// Is the value an array?
		
		            if (Object.prototype.toString.apply(value) === '[object Array]') {
		
		// The value 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');
		        };
		    }
		}());

    $.toJSON = function(text, reviver) {
        if (typeof reviver == "undefined") {
            reviver = null;
        }
        return JSON.parse(text, reviver);
    };
    $.jSONToString = function(value, replacer, space) {
        if (typeof replacer == "undefined") {
            replacer = null;
        }
        if (typeof space == "undefined") {
            space = null;
        }
        return JSON.stringify(value, replacer, space);
    };
    
})(jQuery);//DropdownList.js
$(document).ready(function() {$('#wedding-navigation li').mouseover(function() { $(this).addClass("over"); }).mouseout(function() { $(this).removeClass("over"); });});
/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.2, 09.03.2009
* by Andreas Eberhard, andreas.eberhard@gmail.com
*                      http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*
* Changelog:
*    09.03.2009 Version 1.2
*    - Update for jQuery 1.3.x, removed @ from selectors
*    11.09.2007 Version 1.1
*    - removed noConflict
*    - added png-support for input type=image
*    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
*    31.05.2007 initial Version 1.0
* --------------------------------------------------------------------
* @example $(function(){$(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready
*
* jQuery(function(){jQuery(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready when using noConflict
*
* @example $(function(){$('div.examples').pngFix();});
* @desc Fixes all PNG's within div with class examples
*
* @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
* @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
* --------------------------------------------------------------------
*/

(function($) {

    jQuery.fn.pngFix = function(settings) {

        // Settings
        settings = jQuery.extend({
            blankgif: 'blank.gif'
        }, settings);

        var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
        var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

        if (jQuery.browser.msie && (ie55 || ie6)) {

            //fix images with png-source
            jQuery(this).find("img[src$=.png]").each(function() {

                jQuery(this).attr('width', jQuery(this).width());
                jQuery(this).attr('height', jQuery(this).height());

                var prevStyle = '';
                var strNewHTML = '';
                var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
                var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
                var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
                var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
                var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
                var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
                if (this.style.border) {
                    prevStyle += 'border:' + this.style.border + ';';
                    this.style.border = '';
                }
                if (this.style.padding) {
                    prevStyle += 'padding:' + this.style.padding + ';';
                    this.style.padding = '';
                }
                if (this.style.margin) {
                    prevStyle += 'margin:' + this.style.margin + ';';
                    this.style.margin = '';
                }
                var imgStyle = (this.style.cssText);

                strNewHTML += '<span ' + imgId + imgClass + imgTitle + imgAlt;
                strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;' + imgAlign + imgHand;
                strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
                strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
                strNewHTML += imgStyle + '"></span>';
                if (prevStyle != '') {
                    strNewHTML = '<span style="position:relative;display:inline-block;' + prevStyle + imgHand + 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;' + '">' + strNewHTML + '</span>';
                }

                jQuery(this).hide();
                jQuery(this).after(strNewHTML);

            });

            // fix css background pngs
            jQuery(this).find("*").each(function() {
                var bgIMG = jQuery(this).css('background-image');
                if (bgIMG.indexOf(".png") != -1) {
                    var iebg = bgIMG.split('url("')[1].split('")')[0];
                    jQuery(this).css('background-image', 'none');
                    jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
                }
            });

            //fix input with png-source
            jQuery(this).find("input[src$=.png]").each(function() {
                var bgIMG = jQuery(this).attr('src');
                jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
                jQuery(this).attr('src', settings.blankgif)
            });

        }

        return jQuery;

    };

})(jQuery);
$(function() { $(document).pngFix(); });
//common.show-hide-more-text.js
$(document).ready(function() {
$('span.more-text-holder:eq(0)> span').hide();
    $('span#moretext').hide();
    $('label#dot').show();
    $('a#anchorMore').show();
    $('span.more-text-holder:eq(0)> a').click(function() {
        $(this).next().show('slow');
        $('a#anchorMore').hide();
        $('label#dot').hide();
        $('span#moretext').show();
    });
});// starting of FashionListing.js


var asmxFashionDesigners = "/API/Fashion/JSWSFashionDesigners.asmx/";
var asmxFashionListing = "/API/Fashion/JSWSFashionListing.asmx/";
var asmxWeddingDress = "/API/Fashion/JSWSSearchWeddingDress.asmx/";
var asmxFashionSearch = "/API/Fashion/JSWSSearchWeddingUrl.asmx/";
var asmxSuppliers = "/API/Suppliers/JSWSSuppliers.asmx/";

var $HitchedAjaxOptions = {
    type: "POST",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(result) {
        alert("Error in server:" + result.status + ' ' + result.statusText);
    }
};
var ajaxQueue = $.manageAjax.create('AjaxQueue', { queue: true, cacheResponse: true });

var pageNo =1;
var loadingImage = false;
var totalRandomImagesPerCall;
var currentImageIndex = 1;
var getNextResult = false;
var sCallbackObj = { };
var sCallbackObjID = { };
var sLoadFashionSupplierList = { };
var sGetSupplierList = { };

var srchDesignerName,srchGownType,srchNeckline,srchFabric,srchTrain,srchColour;

function AdjustHeightForDesign() {
     
	 var myoldHeight = $("#divMainFashionIntro").height();
	 if (myoldHeight !== null && myoldHeight !== undefined) {	     
	     mydivHeight = $('#two-content').attr("offsetHeight");
			$('span.more-text-holder:eq(0)> span').hide();     
			$('span#moretext').hide();     
			$('label#dot').show(); 
			$('a#anchorMore').show();  

			var newHeight = $("#divMainFashionIntro").height();


			 // Adjust height of the left and content panel
			 $("two-content").css("height","auto");
			 $("two-left").css("height","auto");
			 ReAssignHieght('two-content', mydivHeight, newHeight - myoldHeight);
			 AdjustHeight();   

	 }
	 divHeight = $('#two-content').attr("offsetHeight");
	 oldHeight = $("span[id$='lblIntro']").height();

}
function AdjustSupplierListingHeight(oldHeight)
{
	var divHeight = $("#two-content").height();
	var newHeight = $("#divFashionSupplierListing").height();
	if(oldHeight > newHeight)
	{
		newHeight = newHeight + 10;
	}
	ReAssignHieght('two-content',divHeight,newHeight-oldHeight);
	AdjustHeight();
}
 
function LinkFashionSearch() {

    var q = $HitchedAjaxOptions;
    q.url = asmxFashionSearch + "GetFashionSearchUrl";
    q.data = "{designerName: '" + designer + "', gownType: '" + gownType + "', neckline: '" + neckLine + "', fabric: '" + fabric + "', train: '" + train + "', color: '" + color + "'}";
    q.success = CallbackGetFashionSearchUrl;
    ajaxQueue.add(q);
	//SearchWeddingUrl.GetFashionSearchUrl(srchDesignerName,srchGownType,srchNeckline,srchFabric,srchTrain,srchColour,CallbackGetFashionSearchUrl);	 
}

function CallbackGetFashionSearchUrl(result)
{
    location.href = result.d;
}
function GetSearchValues()
{
    srchDesignerName = $("#hdnDesignerName").val();
    srchGownType = $("#hdnGownType").val();
    srchNeckline = $("#hdnNeckline").val();
    srchFabric = $("#hdnFabric").val();
    srchTrain = $("#hdnTrain").val();
    srchColour = $("#hdnColour").val();

}


function CheckIsEmpty(designResult, text)
{
if(designResult === null || designResult === undefined)
{return true;}
if(text === null || text === undefined)
{return true;}
if(text === "")
{return true;}

return false;
}
 
 
function ToggleDesignDetails(designResult,clientID)
{
if(!CheckIsEmpty(designResult,designResult.DesignName))
{$(clientID + "liStyle").show();}
else{$(clientID + "liStyle").hide();}
    
if(!CheckIsEmpty(designResult,designResult.GownLength))
{$(clientID + "liGownLength").show();}
else
{$(clientID + "liGownLength").hide();}
    
if(!CheckIsEmpty(designResult,designResult.SleeveLength))
{$(clientID + "liSleeveLength").show();}
else
{$(clientID + "liSleeveLength").hide();}
   
if(!CheckIsEmpty(designResult,designResult.Silhouette))
{$(clientID + "liSilHouette").show();}
else
{$(clientID + "liSilHouette").hide();}
    
if(!CheckIsEmpty(designResult,designResult.Colors))
{$(clientID + "liColor").show();}
else
{$(clientID + "liColor").hide();}

if(!CheckIsEmpty(designResult,designResult.Fabric))
{$(clientID + "liFabric").show();}
else
{$(clientID + "liFabric").hide();}
    
if(!CheckIsEmpty(designResult,designResult.NeckLine))
{$(clientID + "liNeckLine").show();}
else
{$(clientID + "liNeckLine").hide();}
    
if(!CheckIsEmpty(designResult,designResult.SleeveType))
{$(clientID + "liSleeveStyle").show();}
else
{$(clientID + "liSleeveStyle").hide();}
    
if(!CheckIsEmpty(designResult,designResult.Description))
{$(clientID + "liDescription").show();}
else
{$(clientID + "liDescription").hide();}
}
 



$(function() 
  {
		var options={zoomWidth: 200,zoomHeight: 380};
		$(".jqzoom").jqzoom(options);
  });
  var divHeight;
  var oldHeight;
  $(document).ready(function() {
      AdjustDesignHeight(0);

      AdjustHeightForDesign();
      $('span.more-text-holder:eq(0)> a').click(function() {

          var newHeight = $("span[id$='lblIntro']").height();
          // Adjust height of the left and content panel
          $("two-content").css("height", "auto");

          ReAssignHieght('two-content', divHeight, newHeight - oldHeight);
          AdjustHeight();

      });
      $('ul#advert').innerfade({
          speed: 1000,
          timeout: 5000,
          type: 'sequence',
          containerheight: '150px'
      });
      $("#ctl00_ctl00_ContentMain_ContentMain_hlkNext").attr({
          href: "#"
      });
      $("#ctl00_ctl00_ContentMain_ContentMain_hlkPrevious").attr({
          href: "#"
      });

      $(".SearchFashionSupplierImage").click(function() {
          $(this).removeAttr("click");
          return false;
      });

      $('ul#advert').show();
      $("#ancRemoveDesigner").click(function() {
          GetSearchValues();
          srchDesignerName = "";
          LinkFashionSearch();

      });

      $("#ancRemoveGownType").click(function() {
          GetSearchValues();
          srchGownType = "";
          LinkFashionSearch();
      });


      $("#ancRemoveNeckline").click(function() {
          GetSearchValues();
          srchNeckline = "";
          LinkFashionSearch();
      });

      $("#ancRemoveFabric").click(function() {
          GetSearchValues();
          srchFabric = "";
          LinkFashionSearch();
      });

      $("#ancRemoveTrain").click(function() {
          GetSearchValues();
          srchTrain = "";
          LinkFashionSearch();
      });

      $("#ancRemoveColour").click(function() {
          GetSearchValues();
          srchColour = "";
          LinkFashionSearch();
      });

      var fashionSearchPrefixedID = $("#hdnFashionSearchClientID").val();

      $(fashionSearchPrefixedID + "imgSearch").click(function() {
          $(fashionSearchPrefixedID + "divFashionSearchError").css("display", "none");
          var designer = $(fashionSearchPrefixedID + "ddlDesigner").val();
          var gownType = $(fashionSearchPrefixedID + "ddlGownType").val();
          var neckLine = $(fashionSearchPrefixedID + "ddlNeckline").val();
          var fabric = $(fashionSearchPrefixedID + "ddlFabric").val();
          var train = $(fashionSearchPrefixedID + "ddlTrain").val();
          var color = $(fashionSearchPrefixedID + "ddlColour").val();
          if (designer === "" && gownType === "" && neckLine === "" && fabric === "" && train === "" && color === "") {
              $(fashionSearchPrefixedID + "divFashionSearchError").css("display", "inline");
              $(fashionSearchPrefixedID + "lblMessage").html("Please choose some search criteria");
              return false;
          }
          var q = $HitchedAjaxOptions;
          q.url = asmxWeddingDress + "BuildWeddingDress";
          q.data = "{designerName: '" + designer + "', gownType: '" + gownType + "', neckline: '" + neckLine + "', fabric: '" + fabric + "', train: '" + train + "', color: '" + color + "'}";
          q.success = CallBackBuildWeddingDress;
          ajaxQueue.add(q);
          //SearchWeddingDress.BuildWeddingDress(designer, gownType, neckLine, fabric, train, color,CallBackBuildWeddingDress);
          return false;
      });
  }); 
  
function  CallBackBuildWeddingDress(result)
  {
  location.href = result.d;
  }
 function getFashionSupplierID(obj)
 {
 
  return obj.href.substring(obj.href.lastIndexOf('=')+1,obj.href.length);
   
 }
 
 
 function InsertFashionLog(obj)
 {
     
     var q = $HitchedAjaxOptions;
     q.url = asmxFashionListing + "InsertFashionLeadLog";
     q.data = "{supplierID: '" + getFashionSupplierID(obj) + "'}";
     ajaxQueue.add(q);
    return true;
 }
 
 

function isEven(num) {
  return !(num % 2);
}



function GetSerachResultHTMLCallback(result) {
	if  (result !== null && result !== undefined) {
		var ulSupplierStock =  $("#ulSupplierStock");
		ulSupplierStock.html(result.d); 
  }
}
function BuildSearchResultHTML(result,searchText)
{
   if  (result !== null && result !== undefined) {
    var supplierName = $('.lblSupplierName').text();
    
    var q = $HitchedAjaxOptions;
    q.url = asmxFashionListing + "GetSerachResultHTML";
    q.data = "{supplierName: '" + supplierName + "', searchString: '" + searchText + "', mappingList: '" + JSON.stringify(myJSONtext, replacer) + "'}";
    q.success = GetSerachResultHTMLCallback;
    ajaxQueue.add(q);
    
    //FashionListing.GetSerachResultHTML(supplierName,searchText,result,GetSerachResultHTMLCallback); 
  }
}


function EmailFriendCallback(result) {
	if  (result !== null && result !== undefined) {
	 var hlnkEmailFriend = $(sCallbackObj.clientID + "hlnkEmailFriend");
	hlnkEmailFriend.attr({href: result.d}); 
  }
}

function GetDesignURLCallback(result) {
	if  (result !== null && result !== undefined) {
	 var designLink = $(sCallbackObj.clientID + "hdnFashionDesignURL");
	designLink.val(result.d); 
  }
}


function GetSupplierURLCallback(result) {
	if  (result !== null && result !== undefined) {
	 var hlnkSupplier = $(sCallbackObjID.clientID + "hlnkShowCollection");
	hlnkSupplier.attr({href: result.d}); 
  }
}
function EmailAFriendCallback(result) {
	if  (result !== null && result !== undefined) {
	 var hlnkEmailFriend = $(sCallbackObjID.clientID + "hlnkEmailFriend");
	hlnkEmailFriend.attr({href: result.d}); 
  }
}

function GetBreadCrumbCallback(result) {
	if  (result !== null && result !== undefined) { 
		$("span[id$='lblBreadCrum']").html(result.d); 
  }
}
function GetSupplierStockHTMLCallback(result) {
	var ulSupplierStock = $("#ulSupplierStock");
	if  (result !== null && result !== undefined) {
	 ulSupplierStock.html(result.d); 
  }
}
function GetFashionUrlCallback(result) {
	if  (result !== null && result !== undefined) {
	 location.href = result.d; 
  }
}

function GetSupplierListByFashionSupplierIDCallback(result) {
	if (result !== null && result !== undefined) {
		if(result.d !== null && result.d !== undefined)
		{
			if(result.d !== "")
			{
					$(sGetSupplierList.SearchFashionSupplierClientID + "hdnSupplierList").val(result.d);
					$(sGetSupplierList.FashionSupplierListingClientID + "divFashionSupplierMap").css("display","inline");
			}else{
					$(sGetSupplierList.FashionSupplierListingClientID + "divFashionSupplierMap").css("display","none");
			}
		}else{
					$(sGetSupplierList.FashionSupplierListingClientID + "divFashionSupplierMap").css("display","none");
	 	}
	}
}

function GetSupplierList(fashionSupplierID,FashionSupplierListingClientID)
{
	
	 var SearchFashionSupplierClientID  = "#" + $("#hdnSearchFashionSupplierClientID").val() + "_"; 
	 $(SearchFashionSupplierClientID + "lblMsg").html("");
	 $("#divSupplierSearchListing").html("");
	 sGetSupplierList.SearchFashionSupplierClientID = SearchFashionSupplierClientID;
	 sGetSupplierList.FashionSupplierListingClientID = FashionSupplierListingClientID; 
	 
	 var q = $HitchedAjaxOptions;
     q.url = asmxFashionListing + "GetSupplierListByFashionSupplierID";
     q.data = "{_supplierID: " + fashionSupplierID + "}";
     q.success = GetSupplierListByFashionSupplierIDCallback;
     ajaxQueue.add(q);
}

function LoadFashionSupplierListingCallback (result) {
	var FashionSupplierListingClientID  = "#" + $("#hdnFashionSupplierListingClientID").val() + "_";
	$(FashionSupplierListingClientID + "lblSupplierErrorMsg").html(""); 
	if(result.d !== null && result.d !== undefined && result.d !== "") {
		$("#divFashionSupplierContent").html(result.d);
	} else {
		$(FashionSupplierListingClientID + "lblSupplierErrorMsg").html("This designer has no stockists registered with hitched.co.uk");
		$("#divFashionSupplierContent").html("");
	}
	$(FashionSupplierListingClientID + "lblDesignerName").html(sLoadFashionSupplierList.companyName);
	GetSupplierList(sLoadFashionSupplierList.fashionSupplierID,FashionSupplierListingClientID);
}

function LoadFashionSupplierList(fashionSupplierID,companyName) {

	sLoadFashionSupplierList.companyName = companyName;
	sLoadFashionSupplierList.fashionSupplierID = fashionSupplierID;	
	 var q = $HitchedAjaxOptions;
     q.url = asmxFashionListing + "LoadFashionSupplierListing";
     q.data = "{_supplierID: " + fashionSupplierID + "}";
     q.success = LoadFashionSupplierListingCallback;
     ajaxQueue.add(q);
}
 





function GetDesignDetailsByIDCallback(result) {
	if(result !== null && result !== undefined)
	{
	var designResult = result.d;
	var clientID = sCallbackObjID.clientID;
	var currentIndex = sCallbackObjID.currentIndex;

	if(designResult !== null && designResult !== undefined)
	{
		var lblStyleText = $(clientID + "lblStyleText");
		var lblSilHouetteText = $(clientID + "lblSilHouetteText");
		var lblNeckLineText = $(clientID + "lblNeckLineText");
		var lblGownLengthText = $(clientID + "lblGownLengthText");
		var lblSleeveLengthText = $(clientID + "lblSleeveLengthText");
		var lblSleeveStyleText = $(clientID + "lblSleeveStyleText");
		var lblDescriptionText = $(clientID + "lblDescriptionText");
		var lblFabricText = $(clientID + "lblFabricText");
		var lblColorText = $(clientID + "lblColorText");
		var imgSupplier = $(clientID + "imgSupplierLarge");
		var designID = $(clientID + "hdnFashionDesignID");
		var contactDesigner = $(clientID + "hlkDesignerName");
		var designLink = $(clientID + "hdnFashionDesignURL");
		var currentDesignName = $(clientID + "hdnCurrentDesignName");
		var lblCurrentIndex = $(clientID + "lblCurrentDesignIndex");
		var hlnkSupplier = $(clientID + "hlnkShowCollection");
		var supplierName = $(clientID + "lblDescSupplierName");
		var descSupplierName = $(clientID + "lblSupplierName");
		var hlnkEmailFriend = $(clientID + "hlnkEmailFriend");
		var designerImage = $(clientID + "imgDesigner");
		var hlkWebsite = $(clientID + "hlkWebsite");
		designID.val(designResult.FashionDesignID);
		lblStyleText.html(designResult.DesignName);
		lblSilHouetteText.html(designResult.Silhouette);
		lblNeckLineText.html(designResult.NeckLine);
		lblGownLengthText.html(designResult.GownLength);
		lblSleeveLengthText.html(designResult.SleeveLength);
		lblSleeveStyleText.html(designResult.SleeveType);
		lblDescriptionText.html(designResult.Description);
		lblFabricText.html(designResult.Fabric);
		lblColorText.html(designResult.Colors);
		imgSupplier.attr({src: sCallbackObjID.imagePath + designResult.ImageURLLarge});
		hlkWebsite.attr("href", "/f.asp?ct=" & designResult.SupplierID);
		hlkWebsite.html(designResult.CompanyName);
		$('a.jqzoom').attr("href",sCallbackObjID.imagePath + designResult.ImageURLLarge);
		$('a.jqzoom').attr("title", designResult.DesignName);

		var q1 = $HitchedAjaxOptions;
		q1.url = asmxFashionListing + "GetDesignURL";
		q1.data = "{designName: '" + designResult.DesignName + "', sectionName: '" + designResult.sectionName + "', supplierName: '" + designResult.supplierName + "'}";
		q1.success = GetDesignURLCallback;
		ajaxQueue.add(q1); 
		//FashionListing.GetDesignURL(designResult.DesignName, designResult.sectionName, designResult.supplierName, GetDesignURLCallback);

		currentDesignName.val(designResult.DesignName);

		var q2 = $HitchedAjaxOptions;
		q2.url = asmxFashionListing + "GetSupplierURL";
		q2.data = "{sectionName: '" + designResult.sectionName + "', supplierName: '" + designResult.CompanyName + "'}";
		q2.success = GetSupplierURLCallback;
		ajaxQueue.add(q2);
		//FashionListing.GetSupplierURL(designResult.SectionName, designResult.CompanyName, GetSupplierURLCallback);

		var q3 = $HitchedAjaxOptions;
		q3.url = asmxFashionListing + "EmailSearchResultURL";
		q3.data = "{srchDesigner: '" + sCallbackObjID.srchDesigner + "', srchGownType: '" + sCallbackObjID.srchGownType + "', srchNeckLine: '" + sCallbackObjID.srchNeckLine + "', srchFabric: '" + sCallbackObjID.srchFabric + "', srchTrain: '" + sCallbackObjID.srchTrain + "', srchColour: '" + sCallbackObjID.srchColour + "', DesignID: '" + designResult.FashionDesignID + "'}";
		q2.success = EmailAFriendCallback;
		ajaxQueue.add(q3);
		//FashionListing.EmailAFriend(sCallbackObjID.srchDesigner, sCallbackObjID.srchGownType, sCallbackObjID.srchNeckLine, sCallbackObjID.srchFabric, sCallbackObjID.srchTrain, sCallbackObjID.srchColour, designResult.FashionDesignID);

		$(designerImage).fadeOut(2000, function () {
				designerImage.attr({
						src:  sCallbackObjID.imagePath + designResult.CompanyUrl
				});       
				$(designerImage).fadeIn(2000, function () {});    
		});


		hlnkSupplier.html("Show full collection from " + designResult.CompanyName);
		supplierName.html(designResult.CompanyName);
		descSupplierName.html(designResult.CompanyName);

		document.title = sCallbackObjID.baseTitle + " - " + designResult.CompanyName + " - " + designResult.DesignName;
		var q4 = $HitchedAjaxOptions;
		q4.url = asmxFashionListing + "GetBreadCrum";
		//ByVal gender As String, ByVal supplierName As String, ByVal designName As String, ByVal sectionName As String, ByVal sectionID As Integer
		q4.data = "{gender: '" + designResult.Gender + "', supplierName: '" + designResult.CompanyName + "', designName: '" + designResult.DesignName + "', sectionName: '" + designResult.SectionName + "', sectionID: '" + parseInt(designResult.SectionID, 10) + "'}";
		q4.success = GetBreadCrumbCallback;
		ajaxQueue.add(q4);
		//FashionListing.GetBreadCrum(designResult.Gender, designResult.CompanyName, designResult.DesignName, designResult.SectionName, parseInt(designResult.SectionID, 10), GetBreadCrumbCallback);	
		lblCurrentIndex.html(parseInt(currentIndex.val(), 10) + 1);
		LoadFashionSupplierList(designResult.Supplierid,designResult.CompanyName);
		var q5 = $HitchedAjaxOptions;
		q5.url = asmxFashionListing + "GetSupplierStockHTML";
		//ByVal supplierID As Integer, ByVal supplierName As String
		q5.data = "{supplierID: '" + designResult.Supplierid + "', supplierName: '" + designResult.CompanyName + "'}";
		q5.success = GetSupplierStockHTMLCallback;
		ajaxQueue.add(q5);
		//FashionListing.GetSupplierStockHTML(designResult.Supplierid, designResult.CompanyName, GetSupplierStockHTMLCallback);
	}
	ToggleDesignDetails(designResult,clientID);    
	$("#loader").hide();	
	AdjustSupplierListingHeight(oldHeight); 
	return false;

	}
}
function GetDesignDetailsCallback(result) {
  //alert("GetDesignDetailsCallback");
    if(result !== null && result !== undefined){	
	    var designResult = result.d;
	    $.geekGaTrackPageAgain();
	    var clientID = sCallbackObj.clientID;
	    var currentIndex = sCallbackObj.currentIndex;


	    if (!(designResult === null || designResult === undefined)) {
	        $("#divDesigner").html(result.d);
	        if (!(currentIndex === null || currentIndex === undefined)) {
	        
		        var lblStyleText = $(clientID + "lblStyleText");
		        var lblSilHouetteText = $(clientID + "lblSilHouetteText");
		        var lblNeckLineText = $(clientID + "lblNeckLineText");
		        var lblGownLengthText = $(clientID + "lblGownLengthText");
		        var lblSleeveLengthText = $(clientID + "lblSleeveLengthText");
		        var lblSleeveStyleText = $(clientID + "lblSleeveStyleText");
		        var lblDescriptionText = $(clientID + "lblDescriptionText");
		        var lblFabricText = $(clientID + "lblFabricText");
		        var lblColorText = $(clientID + "lblColorText");
		        var imgSupplier = $(clientID + "imgSupplierLarge");
		        var designID = $(clientID + "hdnFashionDesignID");
		        var contactDesigner = $(clientID + "hlkDesignerName");
		        var designLink = $(clientID + "hdnFashionDesignURL");
		        var currentDesignName = $(clientID + "hdnCurrentDesignName");
		        var lblCurrentIndex = $(clientID + "lblCurrentDesignIndex");
		        var descSupplierName = $(clientID + "lblSupplierName");
		        var hlnkEmailFriend = $(clientID + "hlnkEmailFriend");             

		        designID.val(designResult.FashionDesignID);
		        lblStyleText.html(designResult.DesignName);
		        lblSilHouetteText.html(designResult.Silhouette);
		        lblNeckLineText.html(designResult.NeckLine);
		        lblGownLengthText.html(designResult.GownLength);
		        lblSleeveLengthText.html(designResult.SleeveLength);
		        lblSleeveStyleText.html(designResult.SleeveType);
		        lblDescriptionText.html(designResult.Description);
		        lblFabricText.html(designResult.Fabric);
		        lblColorText.html(designResult.Colors);
		        descSupplierName.html(designResult.CompanyName);        

		        imgSupplier.attr({src: sCallbackObj.imagePath + designResult.ImageURLLarge});

		        $('a.jqzoom').attr("href",sCallbackObj.imagePath + designResult.ImageURLLarge);
		        $('a.jqzoom').attr("title", designResult.DesignName);
		        contactDesigner.attr({
				        href:  "/fashion/requestinfo.aspx?SupplierID=" + sCallbackObj.supplierID + "&DesignID=" + designResult.FashionDesignID
		        });
		        currentDesignName.val(designResult.DesignName);
		        document.title = sCallbackObj.baseTitle + " - " + sCallbackObj.supplierName + " - " + designResult.DesignName;
		        lblCurrentIndex.html(parseInt(currentIndex.val(), 10) + 1);

		        var q1 = $HitchedAjaxOptions;
		        q1.url = asmxFashionListing + "GetBreadCrum";
		        //ByVal gender As String, ByVal supplierName As String, ByVal designName As String, ByVal sectionName As String, ByVal sectionID As Integer
		        q1.data = "{gender: '" + sCallbackObj.gender + "', supplierName: '" + sCallbackObj.supplierName + "', designName: '" + designResult.DesignName + "', sectionName: '" + sCallbackObj.sectionName + "', sectionID: '" + designResult.SectionID + "'}";
		        q1.success = GetBreadCrumbCallback;
		        ajaxQueue.add(q1);
    		    
		        //FashionListing.GetBreadCrum(sCallbackObj.gender, sCallbackObj.supplierName, designResult.DesignName, sCallbackObj.sectionName, designResult.SectionID, GetBreadCrumbCallback);
		        var q2 = $HitchedAjaxOptions;
		        q2.url = asmxFashionListing + "GetDesignURL";
		        q2.data = "{designName: '" + designResult.DesignName + "', sectionName: '" + sCallbackObj.sectionName + "', supplierName: '" + sCallbackObj.supplierName + "'}";
		        q2.success = GetDesignURLCallback;
		        ajaxQueue.add(q2); 
		        //FashionListing.GetDesignURL(designResult.DesignName, sCallbackObj.sectionName, sCallbackObj.supplierName, GetDesignURLCallback);
		        var q3 = $HitchedAjaxOptions;
		        q3.url = asmxFashionListing + "EmailFashionDetailURL";
		        q3.data = "{designName: '" + designResult.DesignName + "', sectionName: '" + sCallbackObj.sectionName + "', supplierName: '" + sCallbackObj.supplierName + "'}";
		        q3.success = EmailFriendCallback;
		        ajaxQueue.add(q3); 
		        //FashionListing.EmailFashionDetailURL(designResult.DesignName, sCallbackObj.sectionName, sCallbackObj.supplierName, EmailFriendCallback);

		        var ulSupplierStock = $("#ulSupplierStock");
		        var q4 = $HitchedAjaxOptions;
		        q4.url = asmxFashionListing + "GetSupplierStockHTML";
		        //ByVal supplierID As Integer, ByVal supplierName As String
		        q4.data = "{supplierID: '" + sCallbackObj.supplierID + "', supplierName: '" + sCallbackObj.supplierName + "'}";
		        q4.success = GetSupplierStockHTMLCallback;
		        ajaxQueue.add(q4);
		        //FashionListing.GetSupplierStockHTML(sCallbackObj.supplierID, sCallbackObj.supplierName, GetSupplierStockHTMLCallback);
		        ToggleDesignDetails(designResult, clientID);    
		    }
	    }   

	  
	    $("#loader").hide();
    }
	return false;
} 




function NavigateDesignByID(srchDesigner,srchGownType,srchNeckLine, srchFabric, srchTrain, srchColour,baseTitle,imagePath,clientID,value) {
$("#loader").show();	
$("#loader").height($("#fashion-thumbnail-panel").height());
$("#loader").width($("#fashion-thumbnail-panel").width());
clientID = "#" + clientID + "_";  
var oldHeight = $("#divFashionSupplierListing").height();
var designList = $(clientID + "hdnDesignNameList");
var currentIndex = $(clientID + "hdnCurrentIndex");
var designArray = designList.val().split("||");


if(!(parseInt(currentIndex.val(), 10) + value < 0 || parseInt(currentIndex.val(), 10) + value > designArray.length-1))
	{currentIndex.val(parseInt(currentIndex.val(), 10) + value);}
else if((parseInt(currentIndex.val(), 10) + value) < 0 ) 
	{currentIndex.val(designArray.length-1);}
else if((parseInt(currentIndex.val(), 10) + value) > designArray.length-1 ) 
	{currentIndex.val(0);}


sCallbackObjID = {
	clientID: clientID,
	currentIndex: currentIndex,
	srchDesigner: srchDesigner,
	srchGownType: srchGownType,
	srchNeckLine: srchNeckLine,
	srchFabric: srchFabric,
	srchTrain: srchTrain,
	srchColour: srchColour,
	baseTitle: baseTitle,
	imagePath: imagePath,
	currentIndex: currentIndex,
	value: value};

	var q = $HitchedAjaxOptions;
	q.url = asmxFashionListing + "GetDesignDetailsByID";
	q.data = "{designID: '" + parseInt(designArray[currentIndex.val()], 10) + "'}";
	q.success = GetDesignDetailsByIDCallback;
	ajaxQueue.add(q);
		
//FashionListing.GetDesignDetailsByID(parseInt(designArray[currentIndex.val()], 10), GetDesignDetailsByIDCallback);

return false;
} 

function NavigateDesign(gender,sectionName,supplierName,supplierID,imagePath,clientID,baseTitle,value){
	$("#loader").show();	
	$("#loader").height($("#fashion-thumbnail-panel").height());
	$("#loader").width($("#fashion-thumbnail-panel").width());

	clientID = "#" + clientID + "_";  
	var currentIndex = $(clientID + "hdnCurrentIndex");
	
	var designList = $(clientID + "hdnDesignNameList");
	designArray = designList.val().split("||");
	
	var intPlusVal = parseInt(currentIndex.val(), 10) + value;
	if(!(intPlusVal < 0 || intPlusVal > designArray.length-1))
		{currentIndex.val(intPlusVal);}
	else if((intPlusVal) < 0 ) 
		{currentIndex.val(designArray.length-1);}
	else if((intPlusVal) > designArray.length-1 ) 
		{currentIndex.val(0);}
	
	sCallbackObj = {
	clientID: clientID,
	currentIndex: currentIndex,
	gender: gender,
	sectionName: sectionName,
	supplierName: supplierName,
	supplierID: supplierID,
	imagePath: imagePath,
	baseTitle: baseTitle};
	var q = $HitchedAjaxOptions;
	q.url = asmxFashionListing + "GetDesignDetails";
	q.data = "{designName: '" + designArray[currentIndex.val()] + "', supplierID: '" + parseInt(supplierID, 10) + "'}";
	q.success = GetDesignDetailsCallback;
	ajaxQueue.add(q);
	//FashionListing.GetDesignDetails(designArray[currentIndex.val()],parseInt(supplierID, 10), GetDesignDetailsCallback);
	return false;
}





 
 

 
function ReplaceAll( str,strReplace, strReplaceWith ) 
{
	    var idx = str.indexOf( strReplace);
	    while ( idx > -1 ) 
	    {
	        str = str.replace( strReplace , strReplaceWith );
	        idx = str.indexOf( strReplace );
	    }
	    return str;
}

    


function AssignBackGround(bgColor) {
    $("#tdLeftHandNav").css("backgroundColor", bgColor);
}


function Bookmark(url,title)
{
    
        if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion, 10) >= 4)) 
        {
            window.external.AddFavorite(url,title);
        } 
        else if (navigator.appName == "Netscape") 
        {
            window.sidebar.addPanel(title,url,"");
        } 
        else 
        {
            alert("Press CTRL-D  or CTRL-T  to bookmark");
        }
    
}


function ShowDescription(pnlIntroID)
{
    var divHeight = $("#two-content").attr("offsetHeight");
    var oldHeight = $("#spanTrimmedText").height();
    
    $("#spanTrimmedText").hide();
    $("#spanCompleteText").show();
    $("#" + pnlIntroID).hide();
    
    var newHeight = $("#spanCompleteText").height();
    
    // Adjust height of the left and content panel
    $("#two-content").css("height", "auto");
    
    ReAssignHieght('two-content',divHeight,newHeight-oldHeight);
    AdjustHeight();
   
    
    
   
    return false;
}
function LoadDesigner(fashionSection, fashionDesign) {
	var sectionID = $("#" + fashionSection).val();
	if(sectionID === "0" || sectionID === undefined || sectionID === null)
	{   
        if($('#'+fashionDesign))
        {
	         $('#'+fashionDesign).attr("disabled", true);
        }
        else if($("#ddlDesigners"))
        {
            $("ddlDesigners").attr("disabled", true);
        }			
        $("#" + fashionDesign).val("");
	} else {
	    $("#" + fashionDesign).attr('disabled', false);
	    fashionDesigners = '';
        var q = $HitchedAjaxOptions;
        q.url = asmxFashionDesigners + "GetDesignDetails";
        q.data = "{sectionID: '" + sectionID + "'}";
        q.success = GetDesignDetailsCallback;
        ajaxQueue.add(q);
		//FashionDesigners.GetDesignDetails(sectionID, GetDesignDetailsCallback);
        
	}
}


function GetFashionUrl(fashionSection,fashionDesign)
{
	var sectionID = $("#" + fashionSection).val();
	var fashionDesignLink = "";

	if($("#ddlDesigners"))
	{
		 fashionDesignLink = $("#ddlDesigners").val();
	}
	else if($('#'+fashionDesign))
	{
		fashionDesignLink = $("#" + fashionDesign).val();
	}


	if(fashionDesignLink !== null && fashionDesignLink !== undefined && fashionDesignLink !== "" && sectionID !== 0 && sectionID !== '0')
	{
		location.href = fashionDesignLink;
	}
	else {
	    var q = $HitchedAjaxOptions;
	    q.url = asmxFashionDesigners + "GetFashionUrl";
	    q.data = "{sectionID: '" + sectionID + "'}";
	    q.success = GetFashionUrlCallback;
	    ajaxQueue.add(q);		
	}
	return false;  
}


$(document).ready(function() { 
	$('input.SearchFashionSupplierText').keypress(function(e) {
	if(e.keyCode === 13){return false;}
	});  
	$('input.fashionLocalSearchText').keyup(function(e) {
		if(e.keyCode == 13) 
		{
			$('input.fashionLocalSearch').click();
			return false;
		}
	});  
	$('input.fashionLocalSearch').click(function(){return  GetSupplierListing();});
        
	function GetSupplierListing()    
	{

		 $("#loader_supplier").height($("#divSupplierlisting").height()+20);
		 $("#loader_supplier").width($("#divSupplierlisting").width());
		 $("#lblSupplierListingMsg").html("");
		 var searchText =  jQuery.trim($("input.fashionLocalSearchText").val());
		 if(searchText === "")
		 {
				$("#lblSupplierListingMsg").html("Please enter search text");
				return false;
		 }
		 $("#loader_supplier").show();	
		 var categoryID = $("span.lblCategoryID").text();
		 var sectionID = $("span.lblSectionID").text();  
         var q = $HitchedAjaxOptions;
         q.url = asmxFashionListing + "GetWeddingSupplierListing";
         q.data = "{searchText: '" + searchText + "',categoryID:'" + categoryID + "',sectionID:'" + sectionID + "'}";
         q.success = CallBackGetWeddingSupplierListing;
         ajaxQueue.add(q);
		 return false;
	}

});

function CallBackGetWeddingSupplierListing(result)
{
	if (result.d != null  && result.d != undefined && result.d != "") {   
		$("#divSupplierlisting").html(result.d);
	} else {
		$("#lblSupplierListingMsg").html("No suppliers found");
		$("#divSupplierlisting").html("");
	}     
	$("#loader_supplier").hide();
}


var _pageSize;
var _range;
var _appendedID;
var _isPrint;
var _supplierList;
var _lblMsg; 
var _searchText;

function GetFashionSuppliers(pageSize,range,appendedID,isPrint)
{
 
        _pageSize= pageSize;
        _range = range;
        _appendedID =appendedID;
        _isPrint =isPrint;
        
        var oldHeight = $("#divFashionSupplierListing").height();
        var supplierList = "";
        appendedID ="#" + appendedID +  "_";
        var geocode,searchText;
        var lblMsg = $(appendedID + "lblMsg");
        _lblMsg =lblMsg;
        supplierList = $(appendedID + "hdnSupplierList").val();
        $("#divSupplierSearchListing").html("");
        _supplierList =supplierList; 
        lblMsg.html("");
        // Code to adjust height of the left hand navigation and content area.
        
        searchText = $(appendedID + "txtSearch").val();
        _searchText=searchText;
        if(searchText === "")
        {
            lblMsg.html("Please enter search text");
            return false;
        }
        
        if(supplierList === null || supplierList === "" || supplierList === undefined)
        {
            lblMsg.html("No records to display");
            return false;
        }
              
         var q = $HitchedAjaxOptions; 
         q.url = asmxSuppliers + "GetGeocode";                 
         q.data = "{searchText:'" + _searchText + "'}";                        
         q.success = CallBackGetGeocode;  
         ajaxQueue.add(q);   
        AdjustSupplierListingHeight(oldHeight);
        return false;
 
}


function CallBackGetGeocode(result)
{  
        geocode = result.d;        
        // Get the search Item object
        GetSearchItem(geocode.Latitude, geocode.Longitude, "", _supplierList, _range, globalCurrentPageNo, _pageSize);        
         var q = $HitchedAjaxOptions; 
         q.url = asmxSuppliers + "GetFashionSupplierListingByGeoCode";                 
         q.data = "{_searchMappingItem:" + JSON.stringify(searchItem) + ",searchText:'" + _searchText + "'}";                        
         q.success = CallbackGetFashionSupplierListingByGeoCode;  
         ajaxQueue.add(q);   
}

function CallbackGetFashionSupplierListingByGeoCode(result)
{

      if(result.d.length > 0)
        {                    
            var q = $HitchedAjaxOptions; 
            q.url = asmxSuppliers + "CreateListingHTML";                 
            q.data = "{_mappingList:" + JSON.stringify(result.d) + "}";                        
            q.success = CallbackCreateListingHTML;  
            ajaxQueue.add(q);   
        }
        else
        {
            _lblMsg.html("No records to display");
        }       
}

function CallbackCreateListingHTML(result)
{
	var supplierListing = result.d;	
	if(supplierListing != null  && supplierListing != undefined && supplierListing != "")
	{
		$("#divSupplierSearchListing").html(supplierListing);
		$("#divFashionSupplierContent").hide();   
	}
	if ( _isPrint ==1 ) 
	{
		BuildSearchResultHTML(result,_searchText);
	}        
}
// end of FashionListing.js// Div-adjustments.js
//HACK: Please try to move this to Adjust-Height.js style.
var offSetHeight = 10;
function FixHeight(one, two) {
    if ($('#' + one)) {
        var lh = $('#' + one).height();
        var rh = $('#' + two).height();
        var nh = Math.max(lh, rh);
        $('#' + one).height(nh + offSetHeight);
        $('#' + two).height(nh + offSetHeight);
    }
}
function AdjustHeight()
{
    if($("#two-left"))
    {
        $("#two-left").css("minHeight",$("#two-content").attr("offsetHeight") + offSetHeight + "px");
        if (IsIE6Browser()) 
        {
            $("#two-left").css("height",$("#two-content").attr("offsetHeight") + "px");
        }
        else
        {
             $("#two-left").css("height","auto");
        }
    }
}
function IsIE6Browser()
{
    var returnResult = false;
    var arVersion = navigator.appVersion.split("MSIE");
    var version = parseFloat(arVersion[1]);
    if ((version == 6) && (document.body.filters)) 
    {
        returnResult = true;
    }
    return returnResult;
  
}
function ReAssignHieght(id,orginalHeight,value)
{
        var newheight = orginalHeight + value;
        $('#'+id).css("height", newheight+"px");
}
function AdjustDesignHeight()
{
    if ($("#rndFashionDesign-content")) 
    {     
        var prefixedID = $("#hdnRandomDesignPrefixedID").val() + "_";
        $('#'+prefixedID + "ulRndFashionDesign").css('display','block');  
        if (! IsIE6Browser())
        {
            $("#rndFashionDesign-left").height($("#divFDRandomPanel").height() + 10);
            $("#rndFashionDesign-right").height($("#rndFashionDesign-left").height());
        }
	}
}
// JSGoogleMap
var divString = 0;
var lati=0;
var longi=0;
var ukCenterLat = "54.0710320549604";
var ukCenterLong = "-2.78397635451732";

var mosx,mosy;
var googleMap ;
var googleIcon ;
var clientID;
var markerImage;
var lstLatitude = new Array();
var lstlongitude  = new Array();
var lstlocationDetails = new Array();
var lstMapIcon = new Array();
//var googleMarker;
var googleMarkerArray = new Array();
$(document).ready(function () {
	$('#basicModal input.basic, #basicModal a.basic, #basicModal img.basic').mouseover(function (e) {
		e.preventDefault();
		$("#divGoogleMapPaging").show();
		$('#basicModalContent').modal();
		FillGMap();
		CheckPaging();
	});
});
$(document).ready(function () {
	$('#basicModal input.click, #basicModal a.click, #basicModal img.click').click(function (e) {
		e.preventDefault();
		$("#divGoogleMapPaging").show();
		$('#basicModalContent').modal();
		FillGMap();
		CheckPaging();
	});
});


function DisplayHierarchyLocation(latitude,longitude,details, locationID)
{
    GetClientID();
    $("#" + clientID + "hddnLocationID").val(locationID);
    $("#" + clientID + "divMainMap").show();
    $("#basicModal").hide();
    $('#basicModalContent').modal();
    $("#divGoogleMapPaging").hide();
    var  map = new GMap2(document.getElementById(clientID + "pnlMapCanvas"));
    var center = new GLatLng(latitude,longitude);
    map.setCenter(center, 6);       
    var pointArray = new Array();
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.enableDoubleClickZoom();
    Createmarkers(map,latitude,longitude,"",details);
}

function DisplaySupplierMap(latitudeList,longitudeList,icon,locationDetailsList) {
    GetClientID();
    var index = 0;
    var  map = new GMap2(document.getElementById(clientID + "pnlMapCanvas"));
    if(latitudeList.length > 0)
    {
        var center = new GLatLng(latitudeList[0],longitudeList[0]);
        map.setCenter(center, 6);       
        var pointArray = new Array();
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.enableDoubleClickZoom();
        for(index = 0;index < latitudeList.length ;index++)
        {
           Createmarkers(map,latitudeList[index],longitudeList[index],icon[index],locationDetailsList[index]);
        }
    }
   
}
function Createmarkers(map,lat,lon,icon,details)
{
   markerImage = DefaultHitchedMapIcon();
   var point = new GLatLng(lat, lon);
   if(IsMarkerDraggable())
   {
       $("#" + clientID + "hddnLatitude").val(lat);
       $("#" + clientID + "hddnLongitude").val(lon);
        googleMarker = new GMarker(point, { icon: icon, draggable: true });
        
        GEvent.addListener(googleMarker, "dragstart", function() 
        {
            googleMap.closeInfoWindow();
        });
        GEvent.addListener(googleMarker, "dragend", function() {
            googleMarker.openInfoWindowHtml("Save new location?<br /> <a href='javascript:SaveLocation();'>yes</a>");
            $("#" + clientID + "hddnLatitude").val(googleMarker.getPoint().lat());
            $("#" + clientID + "hddnLongitude").val(googleMarker.getPoint().lng());
        });
    }
    else
    {
        googleMarker = new GMarker(point, { icon: icon, draggable: false }); 
    }
      
   map.addOverlay(googleMarker);
}
function SaveLocation() {
    var myId = $("#" + clientID + "hddnLocationID").val();
    var mylat = $("#" + clientID + "hddnLatitude").val();
    var mylng = $("#" + clientID + "hddnLongitude").val();
    LocationManagement.SaveLocationMapping(myId, mylat, mylng);
}


function SetPageIndex(value)
{
    GetClientID();
    if($('#'+clientID + "hdnCurrentPageIndex"))
    {
       $('#'+clientID + "hdnCurrentPageIndex").val(value);
    }
} 
function ClearMarkers()
{
    lstLatitude = new Array();
    lstlongitude = new Array();
    lstlocationDetails = new Array();
    lstMapIcon = new Array();
}
function GetClientID()
{
    if($("#hdnClientID"))
    {
        clientID = $("#hdnClientID").val() + "_"; 
    }
    else
    {
        clientID = "ctl00_ContentMainPane_ctl00_";
    }
}


function FillVenueGMap()
{  
    GetClientID();
    if($('#'+clientID + "hddnLatitude"))
    {
        var lati =$('#'+ clientID + "hddnLatitude").val();    
        var longi = $('#'+ clientID + "hddnLongitude").val();  
        CreateMap(lati,longi);
    }  
}
function FillGMap()
{  
    FillVenueGMap();
    var index = 0;
    var length = lstLatitude.length;
    for(index = 0;index < length ;index++)
    {
         SetMapMarker(lstLatitude[index],lstlongitude[index],lstlocationDetails[index],lstMapIcon[index],0);
    } 
}

function ShowMap()
{
   $("#basicModalContent").css('display','inline');
}
function CreateMap(latitude,longitude) {
    googleMap = new GMap2(document.getElementById(clientID + "pnlMapCanvas"));
    var point = new GLatLng(latitude,longitude);
    googleMap.setCenter(point, 6);       
    markerImage = new GIcon();
    googleMap.addControl(new GLargeMapControl());
    googleMap.addControl(new GMapTypeControl());
    googleMap.enableDoubleClickZoom(); 
}

function SetMapMarker(latitude, longitude, locationDetails,markerIcon,saveDetails)
{
    var markerPoint = new GLatLng(latitude,longitude); 
    var googleMarker;        
    if(IsMarkerDraggable())
    {
        googleMarker = new GMarker(markerPoint, {icon:markerImage,draggable: true});
        GEvent.addListener(googleMarker,  "dragstart", function() {
                 googleMap.closeInfoWindow();
         });
        GEvent.addListener(googleMarker, "dragend", function() {    
            $('#'+clientID + "hddnLatitude").val(googleMarker.getPoint().lat());
            $('#'+clientID + "hddnLongitude").val(googleMarker.getPoint().lng());
         });
    }
    else
    {
        googleMarker = new GMarker(markerPoint,markerImage); 
    }   
    if(locationDetails !== "" && locationDetails !== undefined && locationDetails !== null)
    {
        GEvent.addListener(googleMarker, "mouseover", 
						function() 
						{
								//alert()
								googleMarker.closeInfoWindow();
								// Open new window with respective info
								googleMarker.openInfoWindowHtml(locationDetails);
						}
				);
    }
    if(saveDetails === 1 || saveDetails === '1')
    {
        var markerIndex = lstLatitude.length;
        lstLatitude[markerIndex] = latitude;
        lstlongitude[markerIndex] = longitude;
        lstlocationDetails[markerIndex] = locationDetails;
        lstMapIcon[markerIndex] = markerIcon;
    }
    googleMap.addOverlay(googleMarker);
}
// Determine whether marker can be dragged or not.
function IsMarkerDraggable()
{
    var isMarkerDraggable = false;

    var hdnMarkerDraggable = $("#hdnMarkerDraggable");

    if (hdnMarkerDraggable.val())
    {
        isMarkerDraggable = hdnMarkerDraggable.val();
    }
    if(isMarkerDraggable === "False" || isMarkerDraggable === "false" || isMarkerDraggable === false)
    {
        isMarkerDraggable = false; 
    }
    else
    {
        isMarkerDraggable =  true; 
    }
    return isMarkerDraggable;
}



//Google Map address.js
var globalCurrentPageNo = 0;
var globalTotalPages = 0;
var getListing= false;
var result= true;
var searchItem;
var isMapVisible = false;


var asmxSuppliers = "/API/Suppliers/JSWSSuppliers.asmx/";

var $HitchedAjaxOptions = {
type: "POST",
contentType: "application/json; charset=utf-8",
      dataType: "json",
      error: function(result) {
            alert("Error in server:" + result.status + ' ' + result.statusText);
      }};
var ajaxQueue = $.manageAjax.create('AjaxQueue', { queue: true, cacheResponse: false });


function DisplaySuppliers(supplierListingClientID,latitudeList,longitudeList,iconList,locationDetailsList)
{
    
        var latitude = latitudeList.split('||');
        var longitude = longitudeList.split('||');
        var locationDetails = locationDetailsList.split('||');
        var icon = iconList.split('||');
        var index = 0;
        var googleMapClientID ="#" + $("#hdnClientID").val() + "_"; 
        supplierListingClientID = "#" + supplierListingClientID + "_"; 
         $(supplierListingClientID + "lblSupplierErrorMsg").html("");
        
        if(!IsListEmpty(latitude)) 
        {
            $(googleMapClientID + "divMainMap").show();
        
            if(!isMapVisible)
            {
                $("#basicModal").hide();
            }
        
            $('#basicModalContent').modal();
            $("#divGoogleMapPaging").hide();
            
            DisplaySupplierMap(latitude,longitude,icon,locationDetails);
        }
        else
        {
            $(supplierListingClientID + "lblSupplierErrorMsg").html("No results found");
        }    
        return false;
   
}
function IsListEmpty(locationList)
{
    var _isListEmpty = true;
    
    if(locationList!== null)
    {
        if(locationList !== "")
        {
            _isListEmpty =  false;
        }
    }
    return _isListEmpty;
}
function ToggleFieldEnableStatus(chkAddressId,titleID,streetID,localityID,countyID,countryID,postCodeID,pnlMapID)
{
    
    var isEnabled = false;

    if ($('#' + chkAddressId).is(':checked'))
    {
         $('#'+pnlMapID).css('display','none');
         isEnabled = true;
    }
    else
    {
       $('#'+pnlMapID).css('display','block');
        
    }
    EnableDisableControls(isEnabled,titleID,streetID,localityID,countyID,countryID,postCodeID);
}
function EnableDisableControls(isEnabled,titleID,streetID,localityID,countyID,countryID,postCodeID)
{
    $('#'+titleID).attr('disabled',isEnabled);
    $('#'+streetID).attr('disabled',isEnabled);
    $('#'+localityID).attr('disabled',isEnabled);
    $('#'+countyID).attr('disabled',isEnabled);
    $('#'+countryID).attr('disabled',isEnabled);
    $('#'+postCodeID).attr('disabled',isEnabled);
    if(!isEnabled)
    {
        // Recreate the map.
        FillGMap();
    }
}
function ShowGoogleMap()
{
       $('#basicModalContent').modal();
       FillGMap();
}
function BindFashionSupplierListing(pageSize,range,supplierList,searchText)
{
      var clientID = $("#hdnClientID").val()+ "_"; 
        var index;
        
        EnableDisablePaging(globalTotalPages,globalCurrentPageNo);
        
        if(getListing)
        {
            var latitude = $('#'+clientID + "hddnLatitude").val();
            var longitude = $('#'+clientID + "hddnLongitude").val();
            
            GetSearchItem(latitude, longitude, "", supplierList, range, globalCurrentPageNo, pageSize);            
             var q = $HitchedAjaxOptions; 
             q.url = asmxSuppliers + "GetFashionSupplierListingByGeoCode";                 
             q.data = "{_searchMappingItem:" + JSON.stringify(searchItem) + ",searchText:'" + _searchText + "'}";                        
             q.success = CallBackBindFashionSupplierListing;  
             ajaxQueue.add(q);               
        }
        
        return false;
    }

function CallBackBindFashionSupplierListing(result)
{
if(result.d.length > 0)
            {
               BuildMap();
               
            }
            else
            {
                alert("No result to show");
            }
}

function CallBackBindSupplierListing(result)
{
     if(result.length > 0)
                 {
               BuildMap();
               
            }
            else
            {
                alert("No result to show");
            }
}

function BindSupplierListing(pageSize,range,categoryID)
{
 
        var clientID = $("#hdnClientID").val() + "_"; 
        var index;
        
        EnableDisablePaging(globalTotalPages,globalCurrentPageNo);
        
        if(getListing)
        {
            var latitude = $('#'+clientID + "hddnLatitude").val();
            var longitude = $('#'+clientID + "hddnLongitude").val();            
            var q = $HitchedAjaxOptions; 
            q.url = asmxSuppliers + "GetSupplierListingByGeoCode";                 
            q.data = "{latitude:'" + latitude + "',longitude:'" + longitude + "',categoryID:'" + categoryID + "',range:" + range + ",currentPageNo:" + globalCurrentPageNo + ",pageSize:" + pageSize + "}";                        
            q.success = CallBackBindSupplierListing;  
            ajaxQueue.add(q);   
        }
        
        
        return false;
     
}




function GetSearchItem(latitude, longitude, categoryID, supplierList, range, currentPageNo, pageSize)
{
    // search item is used in fashionlisting.js so did not changed to call back method          
    $.ajax({
      async: false,
      type: "POST",
      url: asmxSuppliers + "GetSearchItem",
      data: "{latitude:" + parseFloat(latitude) + ",longitude:" + parseFloat(longitude) + ",categoryID:'" + categoryID + "',supplierList:'" + supplierList + "',range:" + parseInt(range,10) + ",currentPageNo:" + parseInt(currentPageNo,10) + ",pageSize:" + parseInt(pageSize,10) + "}",
      contentType: "application/json; charset=utf-8",      
      dataType: "json",
      success:function(resultReturn){      
      searchItem=resultReturn.d;
      }      
    });    
}



function BuildMap()
{
     var googleMapClientID ="#" + $("#hdnClientID").val() + "_"; 
     
     $(googleMapClientID + "divMainMap").show();

     ClearMarkers();
            
     FillVenueGMap();
      
     for(index=0;index<result.length;index++)
     {
        SetMapMarker(result[index].Latitude,result[index].Longitude,result[index].LocationDetails,result[index].IconFile,1);
     }
}
/************************* Function used for demo map *****************************/
function ShowRecords(showLocationDetails)
{
     
        var clientID = $("#hdnClientID").val() + "_"; 
        var index;
        EnableDisablePaging(globalTotalPages,globalCurrentPageNo);
        if(getListing)
        {
            var range = parseInt($("#txtRange").val(),10);
            var latitude = $('#'+clientID + "hddnLatitude").val();
            var longitude = $('#'+clientID + "hddnLongitude").val();
            DemoListing.GetSupplierListingByGeoCode(latitude,longitude,"",range,globalCurrentPageNo,5,showLocationDetails,CallBackGetSupplierListingByGeoCode) ;         
            
        }
        
        return false;
   
    
}

function CallBackGetSupplierListingByGeoCode(result)
{
  if(result.length > 0)
            {
                BuildMap();
                DemoListing.GetSupplierListing(result,CallbackGetSupplierListing);               
            }
            else
            {
                alert("No result to show");
            }
}

function CallbackGetSupplierListing(result)
{
     $("#divSupplierDetails").html(result.value);
}

/************** Functions used for google map paging *********************************/
function IsFirstPage(isEnabled)
{
    if($("#hdnClientID"))
    {
        var clientID = $("#hdnClientID").val() + "_"; 
        if(isEnabled)
        {
            $('#'+clientID + "lnkFirst").css('color','#380062');
            $('#'+clientID + "lnkPrev").css('color','#380062');
            $('#'+clientID + "lnkFirst").css('textDecoration','underline');
            $('#'+clientID + "lnkPrev").css('textDecoration','underline');
            $('#'+clientID + "lnkFirst").css('cursor','pointer');
            $('#'+clientID + "lnkPrev").css('cursor','pointer');
        }
        else
        {
            $('#'+clientID + "lnkFirst").css('color','#696969');
            $('#'+clientID + "lnkPrev").css('color','#696969');
            $('#'+clientID + "lnkFirst").css('textDecoration','none');
            $('#'+clientID + "lnkPrev").css('textDecoration','none');
            $('#'+clientID + "lnkFirst").css('cursor','text');
            $('#'+clientID + "lnkPrev").css('cursor','text');
        }
    }      
    
}
function IsLastPage(isEnabled)
{
    if($("#hdnClientID"))
    {
        var clientID = $("#hdnClientID").val() + "_"; 
        if(isEnabled)
        {      
            
            $('#'+clientID + "lnkNext").css('color','#380062');
            $('#'+clientID + "lnkLast").css('color','#380062');
            $('#'+clientID + "lnkNext").css('textDecoration','underline');
            $('#'+clientID + "lnkLast").css('textDecoration','underline');
            $('#'+clientID + "lnkNext").css('cursor','pointer');
            $('#'+clientID + "lnkLast").css('cursor','pointer');
            
        }
        else
        {            
            $('#'+clientID + "lnkNext").css('color','#696969');
            $('#'+clientID + "lnkLast").css('color','#696969');
            $('#'+clientID + "lnkNext").css('textDecoration','none');
            $('#'+clientID + "lnkLast").css('textDecoration','none');
            $('#'+clientID + "lnkNext").css('cursor','text');
            $('#'+clientID + "lnkLast").css('cursor','text');
        }
    }        
   
}
function CheckPaging()
{
   
        var clientID = $("#hdnClientID").val() + "_"; 
        if(globalCurrentPageNo !== null && globalCurrentPageNo !== 0)
        {
            $('#'+clientID + "hdnCurrentPageIndex").val(globalCurrentPageNo); 
            $('#'+clientID + "lblCurrentPage").html(globalCurrentPageNo); 
        }
        var totalPages = parseInt($('#'+clientID + "hdnTotalPages").val(),10); 
       
        if(globalCurrentPageNo <= 1)
        {
            IsFirstPage(false);
        }
        else
        {
            IsFirstPage(true);
        }
        
        
        if(globalCurrentPageNo >= totalPages)
        {
            IsLastPage(false);
        }
        else
        {
            IsLastPage(true);
        }
        
   
}
function NextPrevPages_Click(totalPages, pageIndex, lblCurrentPageIndex, value)
{
  
        
        getListing = true;
        var clientID = $("#hdnClientID").val() + "_"; 
        var currentPageNo = parseInt($('#'+pageIndex).val(),10); 
        currentPageNo = currentPageNo + value;
        totalPages = $('#'+totalPages).val();
        
        
        if(currentPageNo < 1 || currentPageNo > parseInt(totalPages,10))
        {
            getListing = false;
            return;
           // return false;
        }
        
        globalCurrentPageNo = currentPageNo;
        globalTotalPages = totalPages;
              
        $('#'+pageIndex).val(currentPageNo);
        $('#'+lblCurrentPageIndex).html(currentPageNo);  
   
}

function LastPage_Click(hdnTotalPages, hdnPageIndex, lblCurrentPageIndex)
{
    getListing = true;
    var totalPages = parseInt($("#" + hdnTotalPages).val(),10);
    var pageIndex = parseInt($("#" + hdnPageIndex).val(),1);
    var currentPage = parseInt($("#" + lblCurrentPageIndex).html(),1);
    
    if(currentPage == totalPages)
    {
        getListing = false;
        return;
    }
    
    globalCurrentPageNo = totalPages;
    globalTotalPages = totalPages;
    $("#" + hdnPageIndex).val(totalPages);
    $("#" + lblCurrentPageIndex).html(totalPages);
   
}
function FistPage_Click(totalPages, pageIndex, lblCurrentPageIndex,currentPageNo)
{
    
        getListing = true;
        var clientID = $("#hdnClientID").val() + "_"; 
        totalPages = $('#'+totalPages).val();
        pageIndex =  $('#'+pageIndex).val();
        
        
        if(currentPageNo == parseInt(pageIndex,1))
        {
            getListing = false;
            return;
        }
        
        globalCurrentPageNo = currentPageNo;
        globalTotalPages = totalPages;
        
        $('#'+pageIndex).val(currentPageNo);
        
        $('#'+lblCurrentPageIndex).html(currentPageNo);  
        
        
  
    
}
function EnableDisablePaging(totalPages,currentPageNo)
{
    if(currentPageNo <= 1)
    {
      IsFirstPage(false);
    }
    else
    {
         IsFirstPage(true);
    }
    
    if (parseInt(currentPageNo,1) >= parseInt(totalPages,10))
    {
        IsLastPage(false);
    }
    else
    {
        IsLastPage(true);
    }
}






/*
 * SimpleModal 1.3 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * Copyright (c) 2009 Eric Martin
 * Dual licensed under the MIT and GPL licenses
 * Revision: $Id: jquery.simplemodal.js 205 2009-06-12 13:29:21Z emartin24 $
 */
;(function($){var ie6=$.browser.msie&&parseInt($.browser.version)==6&&typeof window['XMLHttpRequest']!="object",ieQuirks=null,w=[];$.modal=function(data,options){return $.modal.impl.init(data,options);};$.modal.close=function(){$.modal.impl.close();};$.fn.modal=function(options){return $.modal.impl.init(this,options);};$.modal.defaults={appendTo:'body',focus:true,opacity:50,overlayId:'simplemodal-overlay',overlayCss:{},containerId:'simplemodal-container',containerCss:{},dataId:'simplemodal-data',dataCss:{},autoResize:false,zIndex:1000,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:'simplemodal-close',escClose:true,overlayClose:true,position:null,persist:false,onOpen:null,onShow:null,onClose:null};$.modal.impl={opts:null,dialog:{},init:function(data,options){if(this.dialog.data){return false;}ieQuirks=$.browser.msie&&!$.boxModel;this.opts=$.extend({},$.modal.defaults,options);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof data=='object'){data=data instanceof jQuery?data:$(data);if(data.parent().parent().size()>0){this.dialog.parentNode=data.parent();if(!this.opts.persist){this.dialog.orig=data.clone(true);}}}else if(typeof data=='string'||typeof data=='number'){data=$('<div/>').html(data);}else{alert('SimpleModal Error: Unsupported data type: '+typeof data);return false;}this.create(data);data=null;this.open();if($.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog]);}return this;},create:function(data){w=this.getDimensions();if(ie6){this.dialog.iframe=$('<iframe src="javascript:false;"/>').css($.extend(this.opts.iframeCss,{display:'none',opacity:0,position:'fixed',height:w[0],width:w[1],zIndex:this.opts.zIndex,top:0,left:0})).appendTo(this.opts.appendTo);}this.dialog.overlay=$('<div/>').attr('id',this.opts.overlayId).addClass('simplemodal-overlay').css($.extend(this.opts.overlayCss,{display:'none',opacity:this.opts.opacity/100,height:w[0],width:w[1],position:'fixed',left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo(this.opts.appendTo);this.dialog.container=$('<div/>').attr('id',this.opts.containerId).addClass('simplemodal-container').css($.extend(this.opts.containerCss,{display:'none',position:'fixed',zIndex:this.opts.zIndex+2})).append(this.opts.close&&this.opts.closeHTML?$(this.opts.closeHTML).addClass(this.opts.closeClass):'').appendTo(this.opts.appendTo);this.dialog.wrap=$('<div/>').attr('tabIndex',-1).addClass('simplemodal-wrap').css({height:'100%',outline:0,width:'100%'}).appendTo(this.dialog.container);this.dialog.data=data.attr('id',data.attr('id')||this.opts.dataId).addClass('simplemodal-data').css($.extend(this.opts.dataCss,{display:'none'}));data=null;this.setContainerDimensions();this.dialog.data.appendTo(this.dialog.wrap);if(ie6||ieQuirks){this.fixIE();}},bindEvents:function(){var self=this;$('.'+self.opts.closeClass).bind('click.simplemodal',function(e){e.preventDefault();self.close();});if(self.opts.close&&self.opts.overlayClose){self.dialog.overlay.bind('click.simplemodal',function(e){e.preventDefault();self.close();});}$(document).bind('keydown.simplemodal',function(e){if(self.opts.focus&&e.keyCode==9){self.watchTab(e);}else if((self.opts.close&&self.opts.escClose)&&e.keyCode==27){e.preventDefault();self.close();}});$(window).bind('resize.simplemodal',function(){w=self.getDimensions();self.opts.autoResize?self.setContainerDimensions():self.setPosition();if(ie6||ieQuirks){self.fixIE();}else{self.dialog.iframe&&self.dialog.iframe.css({height:w[0],width:w[1]});self.dialog.overlay.css({height:w[0],width:w[1]});}});},unbindEvents:function(){$('.'+this.opts.closeClass).unbind('click.simplemodal');$(document).unbind('keydown.simplemodal');$(window).unbind('resize.simplemodal');this.dialog.overlay.unbind('click.simplemodal');},fixIE:function(){var p=this.opts.position;$.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(i,el){if(el){var bch='document.body.clientHeight',bcw='document.body.clientWidth',bsh='document.body.scrollHeight',bsl='document.body.scrollLeft',bst='document.body.scrollTop',bsw='document.body.scrollWidth',ch='document.documentElement.clientHeight',cw='document.documentElement.clientWidth',sl='document.documentElement.scrollLeft',st='document.documentElement.scrollTop',s=el[0].style;s.position='absolute';if(i<2){s.removeExpression('height');s.removeExpression('width');s.setExpression('height',''+bsh+' > '+bch+' ? '+bsh+' : '+bch+' + "px"');s.setExpression('width',''+bsw+' > '+bcw+' ? '+bsw+' : '+bcw+' + "px"');}else{var te,le;if(p&&p.constructor==Array){var top=p[0]?typeof p[0]=='number'?p[0].toString():p[0].replace(/px/,''):el.css('top').replace(/px/,'');te=top.indexOf('%')==-1?top+' + (t = '+st+' ? '+st+' : '+bst+') + "px"':parseInt(top.replace(/%/,''))+' * (('+ch+' || '+bch+') / 100) + (t = '+st+' ? '+st+' : '+bst+') + "px"';if(p[1]){var left=typeof p[1]=='number'?p[1].toString():p[1].replace(/px/,'');le=left.indexOf('%')==-1?left+' + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"':parseInt(left.replace(/%/,''))+' * (('+cw+' || '+bcw+') / 100) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}}else{te='('+ch+' || '+bch+') / 2 - (this.offsetHeight / 2) + (t = '+st+' ? '+st+' : '+bst+') + "px"';le='('+cw+' || '+bcw+') / 2 - (this.offsetWidth / 2) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}s.removeExpression('top');s.removeExpression('left');s.setExpression('top',te);s.setExpression('left',le);}}});},focus:function(pos){var self=this,p=pos||'first';var input=$(':input:enabled:visible:'+p,self.dialog.wrap);input.length>0?input.focus():self.dialog.wrap.focus();},getDimensions:function(){var el=$(window);var h=$.browser.opera&&$.browser.version>'9.5'&&$.fn.jquery<='1.2.6'?document.documentElement['clientHeight']:$.browser.opera&&$.browser.version<'9.5'&&$.fn.jquery>'1.2.6'?window.innerHeight:el.height();return[h,el.width()];},getVal:function(v){return v=='auto'?0:parseInt(v.replace(/px/,''));},setContainerDimensions:function(){var ch=this.getVal(this.dialog.container.css('height')),cw=this.dialog.container.width(),dh=this.dialog.data.height(),dw=this.dialog.data.width();var mh=this.opts.maxHeight&&this.opts.maxHeight<w[0]?this.opts.maxHeight:w[0],mw=this.opts.maxWidth&&this.opts.maxWidth<w[1]?this.opts.maxWidth:w[1];if(!ch){if(!dh){ch=this.opts.minHeight;}else{if(dh>mh){ch=mh;}else if(dh<this.opts.minHeight){ch=this.opts.minHeight;}else{ch=dh;}}}else{ch=ch>mh?mh:ch;}if(!cw){if(!dw){cw=this.opts.minWidth;}else{if(dw>mw){cw=mw;}else if(dw<this.opts.minWidth){cw=this.opts.minWidth;}else{cw=dw;}}}else{cw=cw>mw?mw:cw;}this.dialog.container.css({height:ch,width:cw});if(dh>ch||dw>cw){this.dialog.wrap.css({overflow:'auto'});}this.setPosition();},setPosition:function(){var top,left,hc=(w[0]/2)-((this.dialog.container.height()||this.dialog.data.height())/2),vc=(w[1]/2)-((this.dialog.container.width()||this.dialog.data.width())/2);if(this.opts.position&&this.opts.position.constructor==Array){top=this.opts.position[0]||hc;left=this.opts.position[1]||vc;}else{top=hc;left=vc;}this.dialog.container.css({left:left,top:top});},watchTab:function(e){var self=this;if($(e.target).parents('.simplemodal-container').length>0){self.inputs=$(':input:enabled:visible:first, :input:enabled:visible:last',self.dialog.data);if(!e.shiftKey&&e.target==self.inputs[self.inputs.length-1]||e.shiftKey&&e.target==self.inputs[0]||self.inputs.length==0){e.preventDefault();var pos=e.shiftKey?'last':'first';setTimeout(function(){self.focus(pos);},10);}}else{e.preventDefault();setTimeout(function(){self.focus();},10);}},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if($.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog]);}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show();}this.focus();this.bindEvents();},close:function(){if(!this.dialog.data){return false;}this.unbindEvents();if($.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog]);}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode);}else{this.dialog.data.hide().remove();this.dialog.orig.appendTo(this.dialog.parentNode);}}else{this.dialog.data.hide().remove();}this.dialog.container.hide().remove();this.dialog.overlay.hide().remove();this.dialog.iframe&&this.dialog.iframe.hide().remove();this.dialog={};}}};})(jQuery);/* =========================================================

// jquery.innerfade.js

// Datum: 2008-02-14
// Firma: Medienfreunde Hofmann & Baldes GbR
// Author: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/
// and Ralf S. Engelschall http://trainofthoughts.org/

 *
 *  <ul id="news"> 
 *      <li>content 1</li>
 *      <li>content 2</li>
 *      <li>content 3</li>
 *  </ul>
 *  
 *  $('#news').innerfade({ 
 *	  animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
 *	  speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
 *	  timeout: Time between the fades in milliseconds (Default: '2000'), 
 *	  type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
 * 		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
 *	  runningclass: CSS-Class which the container getâ€™s applied (Default: 'innerfade'),
 *	  children: optional children selector (Default: null)
 *  }); 
 *

// ========================================================= */


(function($) {

    $.fn.innerfade = function(options) {
        return this.each(function() {   
            $.innerfade(this, options);
        });
    };

    $.innerfade = function(container, options) {
        var settings = {
        		'animationtype':    'fade',
            'speed':            'normal',
            'type':             'sequence',
            'timeout':          2000,
            'containerheight':  'auto',
            'runningclass':     'innerfade',
            'children':         null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null || settings.children === undefined)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.innerfade.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
            		var last = Math.floor ( Math.random () * ( elements.length ) );
                setTimeout(function() {
                    do { 
												current = Math.floor ( Math.random ( ) * ( elements.length ) );
										} while (last == current );             
										$.innerfade.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
						} else if ( settings.type == 'random_start' ) {
								settings.type = 'sequence';
								var current = Math.floor ( Math.random () * ( elements.length ) );
								setTimeout(function(){
									$.innerfade.next(elements, settings, (current + 1) %  elements.length, current);
								}, settings.timeout);
								$(elements[current]).show();
						}	else {
							alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
						}
				}
    };

    $.innerfade.next = function(elements, settings, current, last) {
        if (settings.animationtype == 'slide') {
            $(elements[last]).slideUp(settings.speed);
            $(elements[current]).slideDown(settings.speed);
        } else if (settings.animationtype == 'fade') {
            $(elements[last]).fadeOut(settings.speed);
            $(elements[current]).fadeIn(settings.speed, function() {
							removeFilter($(this)[0]);
						});
        } else
            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
        if (settings.type == "sequence") {
            if ((current + 1) < elements.length) {
                current = current + 1;
                last = current - 1;
            } else {
                current = 0;
                last = elements.length - 1;
            }
        } else if (settings.type == "random") {
            last = current;
            while (current == last)
                current = Math.floor(Math.random() * elements.length);
        } else
            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
	if(element.style.removeAttribute){
		element.style.removeAttribute('filter');
	}
}
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:400,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);/*
 * JQZoom Evolution 1.0.1 - Javascript Image magnifier
 *
 * Copyright (c) Engineer Renzi Marco(www.mind-projects.it)
 *
 * $Date: 12-12-2008
 *
 *	ChangeLog:
 *  
 * $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
 */
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}('(6($){$.30.31=6(G){I H={17:\'32\',18:2l,19:2l,1a:10,1b:0,Q:"2m",2n:1s,2o:12,2p:0.3,14:1s,1p:12,2q:\'1g\',2r:\'23\',2s:\'24\',2t:\'33\',2u:12,2v:1s,2w:\'34 35\',2x:\'1t\'};G=G||{};$.36(H,G);R 4.37(6(){I a=$(4);I d=a.1q(\'14\');$(a).1Q(\'14\');$(a).J(\'38-K\',\'1r\');$(a).J(\'39-3a\',\'1r\');I f=$(a).1q(\'3b\');I g=$("1H",4);I j=g.1q(\'14\');g.1Q(\'14\');I k=U 25(g);I l={};I m=0;I n=0;I p=1u;p=U 1R();I q=(26(d).Y>0)?d:(26(j).Y>0)?j:1u;I r=U 27();I s=U 1v(a[0].2y);I t=U 1c();I u={};I v=12;I y={};I z=1u;I A=12;I B={};I C=0;I D=12;I E=12;I F=12;k.1I();$(4).3c(6(){R 12});$(4).3d(6(e){B.x=e.1w;B.y=e.1x;k.1S();1d()},6(){k.1S();2z()});8(H.1p){2A(6(){1d()},3e)}6 1d(){8(!A){k.28();A=1s;j=g.1q(\'14\');g.1Q(\'14\');d=a.1q(\'14\');$(a).1Q(\'14\');s=U 1v(a[0].2y);8(!v||$.1e.2B){s.1I()}V{8(H.17!=\'1j\'){z=U 1J();z.1d()}t=U 1c;t.1d()}a[0].3f();R 12}};6 2z(){8(H.17==\'1K\'&&!H.1p){g.J({\'1T\':1})}8(!H.1p){A=12;v=12;$(t.5).29(\'1L\');t.Z();8($(\'P.1M\').Y>0){z.Z()}8($(\'P.2a\').Y>0){r.Z()}g.1q(\'14\',j);a.1q(\'14\',d);$().29();a.29(\'1L\');C=0;8(1y(\'.2b\').Y>0){1y(\'.2b\').Z()}}V{8(H.2o){1k(H.17){11\'1j\':s.2c();N;1l:t.1t();N}}}8(H.1p){1d()}};6 25(c){4.5=c[0];4.1I=6(){4.5.1m=c[0].1m};4.28=6(){I a=\'\';a=$(g).J(\'2C-L-W\');m=\'\';I b=\'\';b=$(g).J(\'2C-M-W\');n=\'\';8(a){1U(i=0;i<3;i++){I x=[];x=a.1n(i,1);8(1V(x)==12){m=m+\'\'+a.1n(i,1)}V{N}}}8(b){1U(i=0;i<3;i++){8(!1V(b.1n(i,1))){n=n+b.1n(i,1)}V{N}}}m=(m.Y>0)?1W(m):0;n=(n.Y>0)?1W(n):0};4.5.2D=6(){a.J({\'2E\':\'2F\',\'1h\':\'1X\'});8(a.J(\'Q\')!=\'15\'&&a.2d().J(\'Q\')){a.J({\'2E\':\'2F\',\'Q\':\'2G\',\'1h\':\'1X\'})}8(a.2d().J(\'Q\')!=\'15\'){a.2d().J(\'Q\',\'2G\')}V{}8($.1e.2B||$.1e.3g){$(g).J({Q:\'15\',L:\'2H\',M:\'2H\'})}l.w=$(4).W();l.h=$(4).1f();l.9=$(4).1i();l.9.l=$(4).1i().M;l.9.t=$(4).1i().L;l.9.r=l.w+l.9.l;l.9.b=l.h+l.9.t;a.1f(l.h);a.W(l.w);8(H.2u){k.1S();s.1I()}};R 4};25.13.1S=6(){l.9=$(g).1i();l.9.l=$(g).1i().M;l.9.t=$(g).1i().L;l.9.r=l.w+l.9.l;l.9.b=l.h+l.9.t};6 1c(){4.5=16.2e("P");$(4.5).1Y(\'X\');4.5.3h=6(){$(t.5).Z();t=U 1c();t.1d()};4.2I=6(){1k(H.17){11\'1K\':4.1z=U 1Z();4.1z.1m=k.5.1m;4.5.1N(4.1z);$(4.5).J({\'1T\':1});N;11\'1j\':4.1z=U 1Z();4.1z.1m=s.5.1m;4.5.1N(4.1z);$(4.5).J({\'1T\':1});N;1l:N}1k(H.17){11\'1j\':u.w=l.w;u.h=l.h;N;1l:u.w=(H.18)/y.x;u.h=(H.19)/y.y;N}$(4.5).J({W:u.w+\'S\',1f:u.h+\'S\',Q:\'15\',1h:\'1r\',3i:1+\'S\'});a.3j(4.5)};R 4};1c.13.1d=6(){4.2I();1k(H.17){11\'1K\':g.J({\'1T\':H.2p});(H.1p)?t.1t():t.1o(1u);a.2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;t.1o(e)});N;11\'1j\':$(4.5).J({L:0,M:0});8(H.14){r.2g()}s.2c();a.2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;s.2J(e)});N;1l:(H.1p)?t.1t():t.1o(1u);$(a).2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;t.1o(e)});N}R 4};1c.13.1o=6(e){8(e){B.x=e.1w;B.y=e.1x}8(C==0){I b=(l.w)/2-(u.w)/2;I c=(l.h)/2-(u.h)/2;$(\'P.X\').1g();8(H.2n){4.5.K.20=\'2K\'}V{4.5.K.20=\'2h\';$(\'P.X\').23()}C=1}V{I b=B.x-l.9.l-(u.w)/2;I c=B.y-l.9.t-(u.h)/2}8(2L()){b=0+n}V 8(2M()){8($.1e.1O&&$.1e.2i<7){b=l.w-u.w+n-1}V{b=l.w-u.w+n-1}}8(2N()){c=0+m}V 8(2O()){8($.1e.1O&&$.1e.2i<7){c=l.h-u.h+m-1}V{c=l.h-u.h-1+m}}b=1A(b);c=1A(c);$(\'P.X\',a).J({L:c,M:b});8(H.17==\'1K\'){$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':-(c-m+1),\'M\':-(b-n+1)})}4.5.K.M=b+\'S\';4.5.K.L=c+\'S\';s.1o();6 2L(){R B.x-(u.w+2*1)/2-n<l.9.l}6 2M(){R B.x+(u.w+2*1)/2>l.9.r+n}6 2N(){R B.y-(u.h+2*1)/2-m<l.9.t}6 2O(){R B.y+(u.h+2*1)/2>l.9.b+m}R 4};1c.13.1t=6(){$(\'P.X\',a).J(\'1h\',\'1r\');I b=(l.w)/2-(u.w)/2;I c=(l.h)/2-(u.h)/2;4.5.K.M=b+\'S\';4.5.K.L=c+\'S\';$(\'P.X\',a).J({L:c,M:b});8(H.17==\'1K\'){$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':-(c-m+1),\'M\':-(b-n+1)})}s.1o();8($.1e.1O){$(\'P.X\',a).1g()}V{2A(6(){$(\'P.X\').2P(\'24\')},10)}};1c.13.1P=6(){I o={};o.M=1A(4.5.K.M);o.L=1A(4.5.K.L);R o};1c.13.Z=6(){8(H.17==\'1j\'){$(\'P.X\',a).2Q(\'24\',6(){$(4).Z()})}V{$(\'P.X\',a).Z()}};1c.13.28=6(){I a=\'\';a=$(\'P.X\').J(\'3k\');1B=\'\';I b=\'\';b=$(\'P.X\').J(\'3l\');1C=\'\';8($.1e.1O){I c=a.2R(\' \');a=c[1];I c=b.2R(\' \');b=c[1]}8(a){1U(i=0;i<3;i++){I x=[];x=a.1n(i,1);8(1V(x)==12){1B=1B+\'\'+a.1n(i,1)}V{N}}}8(b){1U(i=0;i<3;i++){8(!1V(b.1n(i,1))){1C=1C+b.1n(i,1)}V{N}}}1B=(1B.Y>0)?1W(1B):0;1C=(1C.Y>0)?1W(1C):0};6 1v(a){4.2S=a;4.5=U 1Z();4.1I=6(){8(!4.5)4.5=U 1Z();4.5.K.Q=\'15\';4.5.K.1h=\'1r\';4.5.K.M=\'-3m\';4.5.K.L=\'3n\';p=U 1R();8(H.2v&&!D){p.1g();D=1s}16.2j.1N(4.5);4.5.1m=4.2S};4.5.2D=6(){4.K.1h=\'1X\';I w=O.21($(4).W());I h=O.21($(4).1f());4.K.1h=\'1r\';y.x=(w/l.w);y.y=(h/l.h);8($(\'P.1D\').Y>0){$(\'P.1D\').Z()}v=1s;8(H.17!=\'1j\'&&A){z=U 1J();z.1d()}8(A){t=U 1c();t.1d()}8($(\'P.1D\').Y>0){$(\'P.1D\').Z()}};R 4};1v.13.1o=6(){4.5.K.M=O.1E(-y.x*1A(t.1P().M)+n)+\'S\';4.5.K.L=O.1E(-y.y*1A(t.1P().L)+m)+\'S\'};1v.13.2J=6(e){4.5.K.M=O.1E(-y.x*O.T(e.1w-l.9.l))+\'S\';4.5.K.L=O.1E(-y.y*O.T(e.1x-l.9.t))+\'S\';$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':4.5.K.L,\'M\':4.5.K.M})};1v.13.2c=6(){4.5.K.M=O.1E(-y.x*O.T((l.w)/2))+\'S\';4.5.K.L=O.1E(-y.y*O.T((l.h)/2))+\'S\';$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':4.5.K.L,\'M\':4.5.K.M})};6 1J(){I a=1y(g).1i().M;I b=1y(g).1i().L;4.5=16.2e("P");$(4.5).1Y(\'1M\');$(4.5).J({Q:\'15\',W:O.21(H.18)+\'S\',1f:O.21(H.19)+\'S\',1h:\'1r\',2T:3o,3p:\'2h\'});1k(H.Q){11"2m":a=(a+$(g).W()+O.T(H.1a)+H.18<$(16).W())?(a+$(g).W()+O.T(H.1a)):(a-H.18-10);1F=b+H.1b+H.19;b=(1F<$(16).1f()&&1F>0)?b+H.1b:b;N;11"M":a=(l.9.l-O.T(H.1a)-H.18>0)?(l.9.l-O.T(H.1a)-H.18):(l.9.l+l.w+10);1F=l.9.t+H.1b+H.19;b=(1F<$(16).1f()&&1F>0)?l.9.t+H.1b:l.9.t;N;11"L":b=(l.9.t-O.T(H.1b)-H.19>0)?(l.9.t-O.T(H.1b)-H.19):(l.9.t+l.h+10);1G=l.9.l+H.1a+H.18;a=(1G<$(16).W()&&1G>0)?l.9.l+H.1a:l.9.l;N;11"3q":b=(l.9.b+O.T(H.1b)+H.19<$(16).1f())?(l.9.b+O.T(H.1b)):(l.9.t-H.19-10);1G=l.9.l+H.1a+H.18;a=(1G<$(16).W()&&1G>0)?l.9.l+H.1a:l.9.l;N;1l:a=(l.9.l+l.w+H.1a+H.18<$(16).W())?(l.9.l+l.w+O.T(H.1a)):(l.9.l-H.18-O.T(H.1a));b=(l.9.b+O.T(H.1b)+H.19<$(16).1f())?(l.9.b+O.T(H.1b)):(l.9.t-H.19-O.T(H.1b));N}4.5.K.M=a+\'S\';4.5.K.L=b+\'S\';R 4};1J.13.1d=6(){8(!4.5.3r)4.5.1N(s.5);8(H.14){r.2g()}16.2j.1N(4.5);1k(H.2q){11\'1g\':$(4.5).1g();N;11\'3s\':$(4.5).2P(H.2s);N;1l:$(4.5).1g();N}$(4.5).1g();8($.1e.1O&&$.1e.2i<7){4.3t=$(\'<2U 3u="2b" 3v="3w" 3x="0"  1m="#"  K="3y-3z: 2V" 3A="2V"></2U>\').J({Q:"15",M:4.5.K.M,L:4.5.K.L,2T:3B,W:(H.18+2),1f:(H.19)}).3C(4.5)};s.5.K.1h=\'1X\'};1J.13.Z=6(){1k(H.2r){11\'23\':$(\'.1M\').Z();N;11\'3D\':$(\'.1M\').2Q(H.2t);N;1l:$(\'.1M\').Z();N}};6 27(){4.5=1y(\'<P />\').1Y(\'2a\').2W(\'\'+q+\'\');4.2g=6(){8(H.17==\'1j\'){$(4.5).J({Q:\'15\',L:l.9.b+3,M:(l.9.l+1),W:l.w}).2k(\'2j\')}V{$(4.5).2k(z.5)}}};27.13.Z=6(){$(\'.2a\').Z()};6 1R(){4.5=16.2e("P");$(4.5).1Y(\'1D\');$(4.5).2W(H.2w);$(4.5).2k(a).J(\'20\',\'2h\');4.1g=6(){1k(H.2x){11\'1t\':2X=(l.h-$(4.5).1f())/2;2Y=(l.w-$(4.5).W())/2;$(4.5).J({L:2X,M:2Y});N;1l:I a=4.1P();N}$(4.5).J({Q:\'15\',20:\'2K\'})};R 4};1R.13.1P=6(){I o=1u;o=$(\'P.1D\').1i();R o}})}})(1y);6 26(a){2Z(a.22(0,1)==\' \'){a=a.22(1,a.Y)}2Z(a.22(a.Y-1,a.Y)==\' \'){a=a.22(0,a.Y-1)}R a};',62,226,'||||this|node|function||if|pos|||||||||||||||||||||||||||||||||||var|css|style|top|left|break|Math|div|position|return|px|abs|new|else|width|jqZoomPup|length|remove||case|false|prototype|title|absolute|document|zoomType|zoomWidth|zoomHeight|xOffset|yOffset|Lens|activate|browser|height|show|display|offset|innerzoom|switch|default|src|substr|setposition|alwaysOn|attr|none|true|center|null|Largeimage|pageX|pageY|jQuery|image|parseInt|lensbtop|lensbleft|preload|ceil|topwindow|leftwindow|img|loadimage|Stage|reverse|mousemove|jqZoomWindow|appendChild|msie|getoffset|removeAttr|Loader|setpos|opacity|for|isNaN|eval|block|addClass|Image|visibility|round|substring|hide|fast|Smallimage|trim|zoomTitle|findborder|unbind|jqZoomTitle|zoom_ieframe|setcenter|parent|createElement|bind|loadtitle|hidden|version|body|appendTo|200|right|lens|lensReset|imageOpacity|showEffect|hideEffect|fadeinSpeed|fadeoutSpeed|preloadImages|showPreload|preloadText|preloadPosition|href|deactivate|setTimeout|safari|border|onload|cursor|crosshair|relative|0px|loadlens|setinner|visible|overleft|overright|overtop|overbottom|fadeIn|fadeOut|split|url|zIndex|iframe|transparent|html|loadertop|loaderleft|while|fn|jqzoom|standard|slow|Loading|zoom|extend|each|outline|text|decoration|rel|click|hover|150|blur|opera|onerror|borderWidth|append|borderTop|borderLeft|5000px|10px|10000|overflow|bottom|firstChild|fadein|ieframe|class|name|content|frameborder|background|color|bgcolor|99|insertBefore|fadeout'.split('|'),0,{}))// JScript File


function ToggleFashionNavigation(HeaderId)
{
    if($('#slideeffectRegion' + HeaderId).is(":hidden"))
    {       
         $("#slideInRegion_" + HeaderId).css({backgroundImage :"url(/Images/down-arrow.gif)"});
         $('#slideeffectRegion' + HeaderId).slideDown('slow');  
    }   
    else
    { 
        $("#slideInRegion_" + HeaderId).css({backgroundImage :"url(/Images/left-arrow.gif)"});
        $('#slideeffectRegion' + HeaderId).slideUp('slow');          
    }
    AdjustHeight(); 
} 

function ToggleFashionSection()
{
    if($('#slideSectionRegion').is(":hidden"))
    {       
         $("#slideInSection").css({backgroundImage :"url(/Images/down-arrow.gif)"});
         $('#slideSectionRegion').slideDown('slow');  
    }   
    else
    {
        $("#slideInSection").css({backgroundImage :"url(/Images/left-arrow.gif)"});
        $('#slideSectionRegion').slideUp('slow');          
    }
    AdjustHeight(); 
} 


$(document).ready(function(){ 

    // For left hand nav
    $('div .toggle-list-head').click(function(){
        var listingId=this.id;
        listingId=listingId.split('_');
       ToggleFashionNavigation(listingId[1]);
    });
    
      $('div .toggle-section-head').click(function(){
       ToggleFashionSection();
    });


});