﻿/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);//**************************************************************
// jQZoom allows you to realize a small magnifier window,close
// to the image or images on your web page easily.
//
// jqZoom version 2.2
// Author Doc. Ing. Renzi Marco(www.mind-projects.it)
// First Release on Dec 05 2007
// i'm looking for a job,pick me up!!!
// mail: renzi.mrc@gmail.com
//**************************************************************

(function(jQuery) {

    jQuery.fn.jqueryzoom = function(options) {

        var settings = {
            xzoom: 200, 	//zoomed width default width
            yzoom: 200, 	//zoomed div default width
            offset: 10, 	//zoomed div default offset
            position: "right", //zoomed div default position,offset position is to the right of the image
            lens: 1, //zooming lens over the image,by default is 1;
            preload: 0

        };

        var sender = this;
        //Load lens
        loadLens(sender);

        if (options) {
            jQuery.extend(settings, options);
        }

        jQuery(this).hover(function() {

            var imageLeft = jQuery(this).children('img').offset().left;
            var imageTop = jQuery(this).children('img').offset().top;
            var imageWidth = jQuery(this).children('img').get(0).offsetWidth;
            var imageHeight = jQuery(this).children('img').get(0).offsetHeight;
            var bigimage = jQuery(this).children("img").attr("class");
            var leftpos;


            if (imageLeft > 0 && imageWidth > 0) {

                if (jQuery("div.zoomdiv").get().length == 0) {
                    jQuery("body").append("<div class='zoomdiv'><img class='bigimg' src='" + bigimage + "'/></div>");
                    //jQuery(this).append("<div class='jqZoomPup'>&nbsp;</div>");
                }

                if (settings.position == "right") {
                    if (imageLeft + imageWidth + settings.offset + settings.xzoom > screen.width) {
                        leftpos = imageLeft - settings.offset - settings.xzoom;
                    } else {
                        leftpos = imageLeft + imageWidth + settings.offset;
                    }
                } else {
                    leftpos = imageLeft - settings.xzoom - settings.offset;
                    if (leftpos < 0) {
                        leftpos = imageLeft + imageWidth + settings.offset;
                    }
                }


                jQuery("div.zoomdiv").css({ top: imageTop - 1, left: leftpos });
                jQuery("div.zoomdiv").width(settings.xzoom);
                jQuery("div.zoomdiv").height(settings.yzoom);
                jQuery("div.zoomdiv").show();

                if (!settings.lens) {
                    jQuery(this).css('cursor', 'crosshair');
                }
                jQuery(document.body).mousemove(function(e) {

                    mouse = new MouseEvent(e);

                    /*jQuery("div.jqZoomPup", sender).hide();*/

                    var bigwidth = jQuery(".bigimg").get(0).offsetWidth;
                    var bigheight = jQuery(".bigimg").get(0).offsetHeight;
                    var scaley = 'x';
                    var scalex = 'y';


                    if (isNaN(scalex) || isNaN(scaley)) {
                        var scalex = (bigwidth / imageWidth);
                        var scaley = (bigheight / imageHeight);

                        if (scalex >= 1 && scaley >= 1) {
                            jQuery("div.jqZoomPup", sender).width((settings.xzoom) / scalex);
                            jQuery("div.jqZoomPup", sender).height((settings.yzoom) / scaley);
                        }

                        //                        if(settings.lens){
                        //                        jQuery("div.jqZoomPup", sender).css('visibility','visible');
                        //					    }

                    }

                    xpos = mouse.x - jQuery("div.jqZoomPup", sender).width() / 2 - imageLeft;
                    ypos = mouse.y - jQuery("div.jqZoomPup", sender).height() / 2 - imageTop;

                    if (settings.lens) {
                        xpos = (mouse.x - jQuery("div.jqZoomPup", sender).width() / 2 < imageLeft) ? 0 : (mouse.x + jQuery("div.jqZoomPup", sender).width() / 2 > imageWidth + imageLeft) ? (imageWidth - jQuery("div.jqZoomPup", sender).width() - 2) : xpos;
                        ypos = (mouse.y - jQuery("div.jqZoomPup", sender).height() / 2 < imageTop) ? 0 : (mouse.y + jQuery("div.jqZoomPup", sender).height() / 2 > imageHeight + imageTop) ? (imageHeight - jQuery("div.jqZoomPup", sender).height() - 2) : ypos;

                    }

                    if (settings.lens) {
                        jQuery("div.jqZoomPup", sender).css({ top: ypos, left: xpos });
                    }

                    scrolly = ypos;
                    jQuery("div.zoomdiv").get(0).scrollTop = scrolly * scaley;
                    scrollx = xpos;
                    jQuery("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex;


                });
            }
        }, function() {

            jQuery(document.body).unbind("mousemove");
            if (settings.lens) {
                //Remove lens
                jQuery("div.jqZoomPup", sender).remove();
                //Load lens - Returns lens in previous position
                loadLens(this);
            }
            jQuery("div.zoomdiv").remove();

        });

        count = 0;

        if (settings.preload) {
            jQuery('body').append("<div style='display:none;' class='jqPreload" + count + "'>preload</div>");
            jQuery(this).each(function() {
                var imagetopreload = jQuery(this).children("img").attr("class");
                var content = jQuery('div.jqPreload' + count + '').html();
                jQuery('div.jqPreload' + count + '').html(content + '<img src=\"' + imagetopreload + '\">');

            });
        }
    }

})(jQuery);

function MouseEvent(e) {
this.x = e.pageX;
this.y = e.pageY;


}

function loadLens(sender) {
    jQuery(sender).append("<div class='jqZoomPup ui-corner-all'>&nbsp;</div>");
    jQuery("div.jqZoomPup", sender).show().fadeTo(100, 0.6);
}/**
 * @author Alexander Farkas
 * v. 1.1
 */

(function($){
	
	if(!document.defaultView || !document.defaultView.getComputedStyle){
		var oldCurCSS = jQuery.curCSS;
		jQuery.curCSS = function(elem, name, force){
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
})(jQuery);

(function($) {
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			
			var start = $.curCSS(fx.elem,'backgroundPosition');
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			fx.start = [start[0],start[2]];
			
			var end = toArray(fx.options.curAnim.backgroundPosition);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);﻿function jMessageLabel(jText, jState, jIcon, jIconPosition) {
    //Use: jMessageLabel("SomeText", "default", "info", "left")
    //Use: jMessageLabel("SomeText", "error", "alert", "left")
    var siteMessage;
        siteMessage = "<span class='jqwc-message-label ui-widget ui-corner-all ui-state-" + jState + " jqwc-icon-" + jIconPosition + "'>"
        siteMessage += "<span class='ui-icon ui-icon-" + jIcon + "'></span>"
        siteMessage += jText + "</span>"                          

    return siteMessage
    
    }
  
function jHyperlink(jText, jURL, jButtonStyle, jIcon, jIconPosition) {
    //Use: jHyperlink("SomeText", "http://www.google.com", "default", "circle-triangle-e", "right")
    var siteMessage;
        siteMessage = "<a href='" + jURL + "' class='jqwc-button ui-corner-all jqwc-button-" + jButtonStyle + " jqwc-state-default jqwc-icon-" + jIconPosition + "'>"
        siteMessage += "<span class='ui-icon ui-icon-" + jIcon + "'></span>"
        siteMessage += jText + "</a>"

    return siteMessage
    
    }
               
                                     
jQuery(function(){
		//all hover and click logic for buttons
		jQuery(".jqwc-button:not(.jqwc-state-disabled)")
		.hover(
			function(){ 			
				jQuery(this).addClass("jqwc-state-hover").removeClass("jqwc-state-default");
			},
			function(){ 
				jQuery(this).removeClass("jqwc-state-hover").addClass("jqwc-state-default"); 
			}
		)
		.mousedown(function(){
				jQuery(this).parents('.jqwc-buttonset-single:first').find(".jqwc-button.jqwc-state-active").removeClass("jqwc-state-active");
				if(jQuery(this).is('.jqwc-state-active.jqwc-button-toggleable, .jqwc-buttonset-multi .jqwc-state-active') ){ jQuery(this).removeClass("jqwc-state-active"); }
				else {jQuery(this).addClass("jqwc-state-active"); }	
		})
		.mouseup(function(){
			if(!jQuery(this).is('.jqwc-button-toggleable, .jqwc-buttonset-single .jqwc-button,  .jqwc-buttonset-multi .jqwc-button') ){
				jQuery(this).removeClass("jqwc-state-active");
			}
		});
	});



﻿/* 
 * jQuery jDotForm plugin 0.11 - Turn any container element into Ajax form
 * This plugin is aimed to avoid the form limitations of ASP.NET. but can be used on other platforms as well.
 * 
 * Example:
 * HTML Form: 
 *              <div class="someForm"><input type='text' id='name'/><button type='submit'>submit</button></div>
 * Call jDotForm: 
 *              $('.someForm').jDotForm({ service: 'yourService.ashx' }); 
 * Settings:
 *              service: Set the the web service url 
 *              validate: Boolean - Build in validation
 *              onSuccess: Callback function upon successful submition
 *              onError: Callback function upon unsuccessful submition
 *
 * Form Validation
 * validationRules: Regular expression based form validation rules.
 *
 * Example:
 *  {required: { regex: '\\w+', message: 'Required!'}}
 *  check all elements with class "required" for "regex" if false show "message"
 *
 *
 * Custom occasions:
 *
 * Compare paswords setup:
 * <input type="text" class="password"/>
 * <input type="text" class="password2"/>
 * If script detects field with class "password2" it will compare to field with class "password" id exists
 *
 *               
 * Copyright (c) 2009 Anton Simov
 * Distributed under the GPL licenses.
 */

// Define the jDotForm plugin
 (function($) {
     $.fn.jDotForm = function(options, rules) {
         var settings = {
             service: 'yourWebService', //Required!
             validate: true,
             onSuccess: dummy, //default success
             onError: dummy //default error
         };
         var validationRules = {
             required: { regex: '\\S', message: 'Required!' },
             date: { regex: '^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$', message: 'Invalid Date!\nCorrect format: dd/mm/yyyy' },
             email: { regex: '^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$', message: 'Invalid Email!' },
             size: { regex: '^\\S{6,}$', message: 'Password Too short!' },
             integer: { regex: '^\\d+$', message: 'Use only integers!' },
             password2: { regex: '\\blank', message: 'Passwords do not match!' }

         };
         $.extend(settings, options);
         $.extend(validationRules, rules);

         return this.each(function() {

             var jFrm = $(this);
             jFrm.addClass('jDotForm');
             $(':input:not(textarea)', jFrm).keydown(function(event) { if (event.keyCode == 13) { $(':submit', jFrm).click(); return false; }; });

             if (settings.validate) { //Attach validate func to blur event of all fields in form. Only if validation is enabled!
                 $(':input:not(:submit)', jFrm).blur(function() { if ($(this).val().length > 0) { $(this).jDotFormValidate(); } });
             }

             $(':submit, .submit', jFrm).click(function() {
                 var serializedFormData; //Contains serialized form data. Validates if validation is enabled
                 if (settings.validate) {
                     if (jFrm.find(':input:not(:submit)').jDotFormValidate()) {
                         serializedFormData = jFrm.find(":input:not(:submit)").serialize();
                     }
                     else { return false; }
                 }
                 else { serializedFormData = jFrm.find(":input:not(:submit)").serialize(); }
                 if (serializedFormData != false) {
                     $(jFrm).addClass('ui-state-disabled');
                     $(":input, :submit", jFrm).attr('disabled', true);

                     $.ajax({
                         type: "POST",
                         url: settings.service,
                         data: serializedFormData,
                         contentType: "application/json;charset=utf-8",
                         async: true,
                         success: function(response) {
                             //alert("success: " + response);
                             if (response != null) {
                                 settings.onSuccess(response);
                             }
                             else {
                                 settings.onError('error');
                             }
                             $(jFrm).removeClass('ui-state-disabled');
                             $(":input, :submit", jFrm).removeAttr('disabled');
                         },
                         error: function(msg) { showMessage(langPack2.errorDefault + ' jdf', 'error', true); }
                     });
                 }
                 return false;
             });

             $.fn.jDotFormValidate = function() {
                 var isValid = true;
                 this.each(function() {
                     var jField = $(this);
                     var cssClassArray = jField.attr('class').split(' '); //Get all css classes of element into array
                     for (var x = 0; x < cssClassArray.length; x++) {
                         if (validationRules[cssClassArray[x]]) {
                             if (cssClassArray[x] == "password2") {

                                 if ($(".password").val() != $(".password2").val()) {
                                     jField.addClass('ui-state-invalid').attr('title', validationRules[cssClassArray[x]].message);
                                     isValid = false;
                                     break;
                                 }

                             }
                             else {
                                 var reg = new RegExp(validationRules[cssClassArray[x]].regex);
                                 if (!reg.test(jField.val())) {
                                     jField.addClass('ui-state-invalid').attr('title', validationRules[cssClassArray[x]].message);
                                     isValid = false;
                                     break;
                                 }
                                 else { jField.removeClass('ui-state-invalid').attr('title', ''); }
                             }
                         }
                     }
                 });
                 return isValid;
             }
         });
     };
     function validateMe(sender) { $(sender).jDotFormValidate() };
     function dummy() { }; //default callback function
 })(jQuery);(function(E){var C,A,G,D=/^.*#/;var B={iframe:null,getDoc:function(){return B.iframe.contentWindow.document},getHash:function(){return B.getDoc().location.hash},setHash:function(H){var I=B.getDoc();I.open();I.close();I.location.hash=H}};var F=function(){var I=B.iframe?B.getHash():location.hash;if(I!=C){C=I;if(B.iframe){location.hash=C}var H=E.history.getCurrent();E.event.trigger("history",[H,A]);A=H}};E.history={add:function(I){I="#"+I.replace(D,"");if(C!=I){var H=E.history.getCurrent();location.hash=C=I;if(B.iframe){B.setHash(C)}E.event.trigger("historyadd",[E.history.getCurrent(),H])}if(!G){G=setInterval(F,100)}},getCurrent:function(){return C.replace(D,"")}};E.fn.history=function(H){E(this).bind("history",H)};E.fn.historyadd=function(H){E(this).bind("historyadd",H)};E(function(){C=location.hash;if(E.browser.msie){B.iframe=E('<iframe style="display:none" src="javascript:false;"></iframe>').prependTo("body")[0];B.setHash(C);C=B.getHash()}})})(jQuery);(function($){$.fn.extend({valid8:function(b){return this.each(function(){$(this).data('valid',false);var a={regularExpressions:[],ajaxRequests:[],jsFunctions:[],onLoading:defaultOnEvent,onValid:defaultOnEvent,onError:defaultOnEvent,validationEvents:['keyup','blur'],validationFrequency:1000,values:null,defaultErrorMessage:'Required'};if(typeof b=='string')a.defaultErrorMessage=b;if(this.type=='checkbox'){a.regularExpressions=[{expression:/^true$/,errormessage:a.defaultErrorMessage}];a.validationEvents=['click']}else a.regularExpressions=[{expression:/^.+$/,errormessage:a.defaultErrorMessage}];$(this).data('settings',$.extend(a,b));initialize(this)})},isValid:function(){var a=true;this.each(function(){validate(this);if($(this).data('valid')==false)a=false});return a}});function initializeDataObject(a){$(a).data('loadings',new Array());$(a).data('errors',new Array());$(a).data('valids',new Array());$(a).data('keypressTimer',null)}function initialize(a){initializeDataObject(a);if($(a).attr('value').length>0&&a.type!='checkbox')validate(a);activate(a)};function activate(b){var c=$(b).data('settings').validationEvents;if(typeof c=='string')$(b)[c](function(e){handleEvent(e,b)});else{$.each(c,function(i,a){$(b)[a](function(e){handleEvent(e,b)})})}};function validate(a){initializeDataObject(a);var b;if(a.type=='checkbox')b=a.checked.toString();else b=a.value;regexpValidation(b.replace(/^[ \t]+|[ \t]+$/,''),a)};function regexpValidation(b,c){$.each($(c).data('settings').regularExpressions,function(i,a){if(!a.expression.test(b))$(c).data('errors')[$(c).data('errors').length]=a.errormessage;else if(a.validmessage)$(c).data('valids')[$(c).data('valids').length]=a.validmessage});if($(c).data('errors').length>0)onEvent(c,'error',false);else if($(c).data('settings').jsFunctions.length>0){functionValidation(b,c)}else if($(c).data('settings').ajaxRequests.length>0){fileValidation(b,c)}else{onEvent(c,'valid',true)}};function functionValidation(c,d){$.each($(d).data('settings').jsFunctions,function(i,a){var v;if(a.values){if(typeof a.values=='function')v=a.values()}var b=v||c;handleLoading(d,a);if(a['function'](b).valid)$(d).data('valids')[$(d).data('valids').length]=a['function'](b).message;else $(d).data('errors')[$(d).data('errors').length]=a['function'](b).message});if($(d).data('errors').length>0)onEvent(d,'error',false);else if($(d).data('settings').ajaxRequests.length>0){fileValidation(c,d)}else{onEvent(d,'valid',true)}};function fileValidation(e,f){$.each($(f).data('settings').ajaxRequests,function(i,c){var v;if(c.values){if(typeof c.values=='function')v=c.values()}var d=v||{value:e};handleLoading(f,c);$.post(c.url,d,function(a,b){if(a.valid){$(f).data('valids')[$(f).data('valids').length]=a.message}else{$(f).data('errors')[$(f).data('errors').length]=a.message}if($(f).data('errors').length>0)onEvent(f,'error',false);else{onEvent(f,'valid',true)}},"json")})};function handleEvent(e,a){if(e.keyCode&&$(a).attr('value').length>0){clearTimeout($(a).data('keypressTimer'));$(a).data('keypressTimer',setTimeout(function(){validate(a)},$(a).data('settings').validationFrequency))}else if(e.keyCode&&$(a).attr('value').length<=0)return false;else{validate(a)}};function handleLoading(a,b){if(b.loadingmessage){$(a).data('loadings')[$(a).data('loadings').length]=b.loadingmessage;onEvent(a,'loading',false)}};function defaultOnEvent(a,b,c){setParentClass(b,c);setMessage(a,b)}function onEvent(a,b,c){var d=b.substring(0,1).toUpperCase()+b.substring(1,b.length);$(a).data(b,c);$(a).data('settings')['on'+d]($(a).data(b+'s'),a,b)}function setParentClass(a,b){var c=$(a).parent();c[0].className=(c[0].className.replace(/(^\s|(\s*(loading|error|valid)))/g,'')+' '+b).replace(/^\s/,'')}function setMessage(a,b){var c=$(b).parent();var d=b.id+"ValidationMessage";var e='validationMessage';if(!$('#'+d).length>0)c.append('<span id="'+d+'" class="'+e+'"></span>');$('#'+d).html("");$('#'+d).text(a[0])}})(jQuery);//**************************************************************
// jQZoom allows you to realize a small magnifier window,close
// to the image or images on your web page easily.
//
// jqZoom version 2.2
// Author Doc. Ing. Renzi Marco(www.mind-projects.it)
// First Release on Dec 05 2007
// i'm looking for a job,pick me up!!!
// mail: renzi.mrc@gmail.com
//**************************************************************

(function(jQuery) {

    jQuery.fn.hoverTip = function(options) {

        var settings = {
            xTip: 150, 	//zoomed width default width
            yTip: 100, 	//zoomed div default width
            xOffset: 10, 	//zoomed div default offset
            yOffset: 0, 	//zoomed div default offset
            position: "top", //zoomed div default position,offset position is to the right of the image            
            preload: 0

        };

        var sender = this;
        
        if (options) {
            jQuery.extend(settings, options);
        }

        jQuery(this).hoverIntent(function() {

            var imageLeft = jQuery(this).offset().left;
            var imageTop = jQuery(this).offset().top;
            var imageWidth = jQuery(this).get(0).offsetWidth;
            var imageHeight = jQuery(this).get(0).offsetHeight;
            var bigimage = jQuery(this).parent().attr("rel");
            var leftpos = imageLeft
            var toppos = imageTop
            
            if (imageLeft > 0 && imageWidth > 0) {

                if (jQuery("div.tipdiv").get().length == 0) {
                    jQuery("body").append("<div class='tipdiv'><img class='tipImage' src='" + bigimage + "'/></div>");                    
                }

//                if (settings.position == "top") {
//                    if (imageTop + settings.offset + settings.yTip > screen.height) {
//                        toppos = imageTop - settings.offset - settings.yTip;
//                    } else {
//                        toppos = imageTop + imageHeight + settings.offset;
//                    }
//                } else {
//                        toppos = imageTop - settings.yTip - settings.offset;
//                    if (toppos < 0) {
//                        toppos = imageLeft + imageHeight + settings.offset;
//                    }
//                }
                
                
            switch(settings.position){
                case 'left':
                    toppos = imageTop - settings.yTip - settings.yOffset;
                    leftpos = imageLeft + settings.xTip - settings.xOffse
                  break;    
                case 'top':
                  toppos = imageTop - settings.yTip - settings.yOffset;
                  leftpos = imageLeft - settings.xOffset;
                  break;  
            }
       
                jQuery("div.tipdiv").css({ top: toppos, left: leftpos });
                jQuery("div.tipdiv").width(settings.xTip);
                jQuery("div.tipdiv").height(settings.yTip);
                jQuery("div.tipdiv").fadeIn(150);

                jQuery(document.body).mousemove(function(e) {



                });
            }
        }, function() {

            jQuery(document.body).unbind("mousemove");
            jQuery("div.tipdiv").remove();

        });

        count = 0;

        if (settings.preload) {
            jQuery('body').append("<div style='display:none;' class='jqPreload" + count + "'>preload</div>");
            jQuery(this).each(function() {
                var imagetopreload = jQuery(this).children("img").attr("rel");
                var content = jQuery('div.jqPreload' + count + '').html();
                jQuery('div.jqPreload' + count + '').html(content + '<img src=\"' + imagetopreload + '\">');

            });
        }
    }

})(jQuery);

function MouseEvent(e) {
this.x = e.pageX;
this.y = e.pageY;


}jQuery.fn.jSlider = function( settings ) {
	settings = jQuery.extend({
        headline : null,
        speed : "normal",
		slideBy : 2
    }, settings);
    return this.each(function() {
		jQuery.fn.jSlider.run( jQuery(this), settings );
    });
};
jQuery.fn.jSlider.run = function($this, settings) {    
    var ul = jQuery("ul:eq(0)", $this);
    var li = ul.children();
    if (li.length > settings.slideBy) {        
        var $next = jQuery("a.next", $this);
        var $back = jQuery("a.back", $this);
        var liWidth = jQuery(li[0]).width();
        var animating = false;
        ul.css("width", (li.length * liWidth));
        $next.click(function() {            
            if (!animating) {
                animating = true;
                offsetLeft = parseInt(ul.css("left")) - (liWidth * settings.slideBy);
                if (offsetLeft + ul.width() > 0) {
                    //$back.css( "display", "block" );
                    ul.animate({
                        left: offsetLeft
                    }, settings.speed, function() {
                        if (parseInt(ul.css("left")) + ul.width() <= liWidth * settings.slideBy) {
                            //$next.css( "display", "none" );
                        }
                        animating = false;
                    });
                } else {
                    animating = false;
                }
            }
            return false;
        });
        $back.click(function() {
            if (!animating) {
                animating = true;
                offsetRight = parseInt(ul.css("left")) + (liWidth * settings.slideBy);
                if (offsetRight + ul.width() <= ul.width()) {
                    //$next.css( "display", "block" );
                    ul.animate({
                        left: offsetRight
                    }, settings.speed, function() {
                        if (parseInt(ul.css("left")) == 0) {
                            //$back.css( "display", "none" );
                        }
                        animating = false;
                    });
                } else {
                    animating = false;
                }
            }
            return false;
        });
        //$next.css("display", "block");
        if (settings.headline != null) { $next.parent().after(["<p class=\"view_all\">", settings.headline, " - ", li.length, " total ( <a href=\"#\">view all</a> )</p>"].join("")); };
        jQuery(".view_all > a, .skip_to_news > a", $this).click(function() {
            var skip_to_news = (jQuery(this).html() == "Skip to News");
            if (jQuery(this).html() == "view all" || skip_to_news) {
                ul.css("width", "auto").css("left", "0");
                //$next.css( "display", "none" );
                //$back.css( "display", "none" );
                if (!skip_to_news) {
                    jQuery(this).html("view less");
                }
            } else {
                if (!skip_to_news) {
                    jQuery(this).html("view all");
                }
                ul.css("width", (li.length * liWidth));
                //$next.css( "display", "block" );
            }
            return false;
        });
    }
};