/******
 *
 * Find a Crew™ 
 *
 ******/

function fn_IsNull(val) { return (String(val) === ""); };

function fn_IsNumeric(numValue){

    var rexNum = /-?\d+(\.\d+)?$/;

    if (rexNum.test(numValue)) {
        return true;
    } else {
        return false;
    };
};

var bitUpdateSession = false;
var intTimeoutSec = ((20 - 1) * 60);
var intTimeout = (1 * 60 * 1000); 
var toTimeout;

function fn_ClosePopup() {
    window.parent.jQuery.modal.close(true);
};

$(function() {
//console.log(bitCheckTimeout);
//console.log(int_Timeout);
    if (bitCheckTimeout) {
        toTimeout = setTimeout( "fn_CheckTimeout()" , intTimeout );
    };
});

$(function() {
    if (bitCheckTimeout) {
        $(document).keyup(function(e) {
            bitUpdateSession = true;
        });
        $("#id_div_SessionTimeout").click(function(e) {
            bit_UpdateSession = true;
            clearTimeout(toTimeout); 
            toTimeout = setTimeout("fn_CheckTimeout()", intTimeout);
        });
    };
});

function fn_CheckSubmit() {
    //console.log("fn_CheckSubmit");

    $.ajax({
        url: '/secure-server/action/get_SessionTimeout.asp',
        timeout: 2000,
        success: function(data) {
                    if (fn_IsNumeric(data)) {
                        intTimeoutSec = (parseInt(data) * -1);
                        //console.log("get_SessionTimeout.asp: " + intTimeoutSec);
                        if (intTimeoutSec <= 0) {
                            $.modal.close();

                            //console.log("Logged out or timed out...")
                            $.modal(strLoginModal, {
                                closeHTML: "",
                                containerCss: {
                                    padding: 0,
                                    height: 435,
                                    width: 750
                                }
                            });
                            return false;
                        };
                        //console.log("Submit Form...");
                        bitSessionChecked = true;
                    };
                  },
        async:   false
    });   

    return true;
};

function fn_SessionExtend() {
    bitUpdateSession = false;
    $.post("/secure-server/action/get_SessionExtend.asp", null,
            function(data) {
                if (data == "Success") {
                    intTimeoutSec = ((20 - 1) * 60);
                    $.modal.close();
                };
            });  
}

function fn_CheckTimeout() {
    //console.log(intTimeoutSec);
    var intCheckTime;
    intCheckTime = Math.round(intTimeoutSec / 60);
    if ((((intCheckTime % 5) == 0) && (intCheckTime < 0)) || ((intCheckTime >= 0) && (intCheckTime <= 2))) {
        $.post("/secure-server/action/get_SessionTimeout.asp", null,
            function(data) {
                if (fn_IsNumeric(data)) {
                    intTimeoutSec = (parseInt(data) * -1);
                    //console.log("get_SessionTimeout.asp: " + intTimeoutSec);
                    if ((intTimeoutSec > 0) && (intTimeoutSec < 2 * 60)) {
                        $.modal.close();
                        $("#id_div_SessionTimeout").modal({ persist: true });
                    }
                    else if (intTimeoutSec <= 0) {
                        if ($('#id_div_SessionTimeout').is(':visible')) {
                            $.modal.close();
                        };
                        if (!$('#id_iframe_login').is(':visible')) {
                            //console.log("Logged out or timed out...")
                            $.modal(strLoginModal, {
                                closeHTML: "",
                                containerCss: {
                                padding: 0,
                                    height: 435,
                                    width: 750
                                    }
                                });
                        };
                        clearTimeout(toTimeout);
                        toTimeout = setTimeout("fn_CheckTimeout()", intTimeout * 5);
                    }
                    else {
                        $.modal.close();
                    };
                } else {
                    //alert("Extend Session Failed..." + data); 
                };
            });     
    } else {
        //console.log("Not Multiple of 5");
    };
    //console.log(intCheckTime);    

    if (bitUpdateSession) {
        fn_SessionExtend();
    } else {
        intTimeoutSec = intTimeoutSec - (1 * 60);
    };
    
    toTimeout = setTimeout( "fn_CheckTimeout()" , intTimeout );

};

/******
* Simple Water Mark 
* July 18, 2009 
* Corey Hart @ http://www.codenothing.com 
*/
/** 
* @mainCSS: Default CSS class used if no metadata found 
******/
; (function($) {
    $.fn.simpleWaterMark = function(mainCSS) {
        if (!mainCSS) mainCSS = 'non-404';
        return this.each(function() {
            var $obj = $(this), title = this.title, css = $.metadata && $obj.metadata().watermark ? $obj.metadata().watermark : mainCSS;

            // Add watermark to begin with 
            if ($obj.val() == '' && title && title != '')
                $obj.addClass(css).val(title);

            // Run operations 
            $obj.focus(function() {
                if ($obj.hasClass(css))
                    $obj.removeClass(css).val('');
            }).blur(function() {
                if ($obj.val() == '' && title && title != '')
                    $obj.addClass(css).val(title);
            }).parents('form').eq(0).submit(function() {
                if ($obj.hasClass(css))
                    $obj.val('');
            });

            // Clear fields on page unload 
            $(window).unload(function() {
                if ($obj.hasClass(css))
                    $obj.removeClass(css).val('');
            });
        });
    };
})(jQuery); 

/******
 *
 * Image preview script 
 * written by Alen Grakalic (http://cssglobe.com)
 *
 ******/
(function($) {
    this.fn_ImagePreview = function() {
        /* CONFIG */
        xOffset = 0;
        yOffset = 0;
        /* END CONFIG */
        $('a.css_ImgPreview').hover(function(e) {
            this.t = this.title;
            this.title = "";
            var strImgSize = this.t;
            if (strImgSize.indexOf('ImgSize=') == 0) {
                strImgSize = strImgSize.substring(8);
            };

            var divImgDesc = $(this).next(".css_ImgDesc");
            var strImgDesc = '';
            if (divImgDesc.html()) { strImgDesc = divImgDesc.html(); }
            
            if (strImgDesc.length) {
                strImgDesc = '<div class="css_Insert_ImgDesc">' + strImgDesc + '</div>';
            };

            var c = ((this.t != '') && (strImgSize == '')) ? '<div class="css_EditDescription" style="text-align: center; padding-top:4px;">' + this.t + '</div>' : '';
            $('#id_ImagePopup').append(
		        '<div id="id_ImagePreview" style="text-align: center;">' +
		            strImgDesc +
		            '<table cellpadding="0" cellspacing="0"><tr><td style="width:500px;height:500px;">' +
		            '<img src="' + this.href + '" alt=""' + strImgSize + ' />' + c +
		            '</td></tr></table>' +
		        '</div>');
            $('#id_ImagePreview')
			    .css('top', (xOffset) + 'px')
			    .css('left', (yOffset) + 'px')
			    .fadeIn('fast');
        },
	    function() {
	        this.title = this.t;
	        $('#id_ImagePreview').remove();
	    });
        $('a.css_ImgPreview').click(function(event) {
            event.preventDefault();
        });
    };
})(jQuery);
// starting the script on page load
$(document).ready(function(){
	fn_ImagePreview();
});

/******
 *
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 ******/
(function($) {
	/**
	 * attaches a character counter to each textarea element in the jQuery object
	 * usage: $("#myTextArea").charCounter(max, settings);
	 */
	 
	$.fn.charCounter = function (max, settings) {
		max = max || 100;
		settings = $.extend({
			container: "<span></span>",
			classname: "charcounter",
			format: "(%1 characters remaining)",
			pulse: true,
			delay: 0
		}, settings);
		var p, timeout;
		
		function count(el, container) {
			el = $(el);
			if (el.val().length > max) {
			    el.val(el.val().substring(0, max));
			    if (settings.pulse && !p) {
			    	pulse(container, true);
			    };
			};
			if (settings.delay > 0) {
				if (timeout) {
					window.clearTimeout(timeout);
				};
				timeout = window.setTimeout(function () {
					container.html(settings.format.replace(/%1/, (max - el.val().length)));
				}, settings.delay);
			} else {
				container.html(settings.format.replace(/%1/, (max - el.val().length)));
			};
		};
		
		function pulse(el, again) {
			if (p) {
				window.clearTimeout(p);
				p = null;
			};
			el.animate({ opacity: 0.1 }, 100, function () {
				$(this).animate({ opacity: 1.0 }, 100);
			});
			if (again) {
				p = window.setTimeout(function () { pulse(el) }, 200);
			};
		};
		
		return this.each(function () {
			var container = (!settings.container.match(/^<.+>$/)) 
				? $(settings.container) 
				: $(settings.container)
					.insertAfter(this)
					.addClass(settings.classname);
			$(this)
				.bind("keydown", function () { count(this, container); })
				.bind("keypress", function () { count(this, container); })
				.bind("keyup", function () { count(this, container); })
				.bind("focus", function () { count(this, container); })
				.bind("mouseover", function () { count(this, container); })
				.bind("mouseout", function () { count(this, container); })
				.bind("paste", function () { 
					var me = this;
					setTimeout(function () { count(me, container); }, 10);
				});
			if (this.addEventListener) {
				this.addEventListener('input', function () { count(this, container); }, false);
			};
			count(this, container);
		});
	};

})(jQuery);

(function($) {
	/******
	 * Custom International Phone Number Entry
	 ******/
	
	$.fn.phoneCounter = function (max, min, settings) {
		max = max || 100;
		min = min || 0;
		settings = $.extend({
			container: "<span></span>",
			classname: "css_Comment",
			format: "%1 digits",
			ex_container: "<span></span>",	 
			ex_format: '%country, %intNumber, %locNumber',
			pulse: true,
			delay: 0
		}, settings);
		var p, timeout;
		
		function count(el, container, ex_container) {
			el = $(el);
			var strPhoneID = el.attr("id");
			if ($('#'+strPhoneID+'TelCCode').length) {
			    if ($('#'+strPhoneID+'TelCCode').val().length > 0) {
                    var intTelMax = max;
                    var intTelMin = min;
                    var intGroup = 4;
	                var strTelCode = '';
	                var strTelCountryName = '';
	                var strTelNDD = '';
	                var strTelACode = '';
	                var strTelACodeMod = '';
	                var strTelLocal = '';
	                var strNumberInt = '';
	                var strNumberLoc = '';
	                var intTelACAD = 0;	
	                var intTelACADMod = 0;
                    var arrTel = $('#'+strPhoneID+'TelCCode').val().split('|');
                    if (arrTel.length > 3) {
	                    var strTelCode 			= arrTel[1];
	                    var strTelNDD			= arrTel[2];
	                    var strTelCountryName	= arrTel[3];                        
                        if (arrTel.length > 4) {
                            if (arrTel[4].length) {
                                intGroup = parseInt(arrTel[4]);
                            };
                        };
                        if (arrTel.length > 5) {
                            strTelLocal = arrTel[5];
                        };
                        if (arrTel.length > 6) {
                            if (arrTel[6].length > 0) {
                                intTelACAD = parseInt(arrTel[6]);
                            };
                        };    	    
                        if (arrTel.length > 8) {
                            if (arrTel[7].length > 0) {
                                intTelMin = parseInt(arrTel[7]);
                            };
                            if (arrTel[8].length > 0) {
                                intTelMax = parseInt(arrTel[8]);
                            };
                        };
                    };
                    if ($('#'+strPhoneID+'TelACode').length > 0) {
                        arrTel = $('#'+strPhoneID+'TelACode').val().split('|');
	                    strTelACode = arrTel[0];
	                    if (arrTel.length > 3) {
	                        if (arrTel[2].length > 0) {
	                            strTelLocal = arrTel[2];
	                        };
	                        if (arrTel[3].length > 0) {
	                            intGroup = parseInt(arrTel[3]);
	                        };
	                    };
                        if (arrTel.length > 4) {
	                        if (arrTel[4].length > 0) {
	                            if (arrTel[4] != '-1') {
	                                intTelACAD = parseInt(arrTel[4]);
	                            };
	                        };
	                    };	    
                        if (arrTel.length > 6) {
	                        if ((arrTel[5].length > 0) && (arrTel[5] != '-1')) {
	                            intTelMin = parseInt(arrTel[5]);
	                        };
	                        if ((arrTel[6].length > 0) && (arrTel[6] != '-1')) {
	                            intTelMax = parseInt(arrTel[6]);
	                        }
	                    }	                             
                    }  
                    
                    max = (intTelMax - (strTelNDD.length + strTelACode.length));
                    min = (intTelMin - (strTelNDD.length + strTelACode.length));
                    if (max < 1) {
                        max = 16; 
                    };
                    if (intGroup < 2) {
                        intGroup = 4;
                    };
			        if (el.val().length > max) {
			            el.val(el.val().substring(0, max));
			            if (settings.pulse && !p) {
			    	        pulse(container, true);
			            };
			        };
			        strNumberInt = el.val();
			        
	                if (intTelACAD > 0) {
	                    if (strTelNDD.length >= 0) {
	                        intTelACADMod = (intTelACAD - strTelNDD.length);
	                    };
	                    if (intTelACADMod >= 0) {
	                        //if (strTelACode.length <= intTelACAD) {    
    	                    strTelACodeMod = strTelACode + strNumberInt; 
    	                    strTelACodeMod = strTelACodeMod.substring(0,intTelACADMod);
    	                    strNumberInt = strTelACode + strNumberInt;
    	                    strNumberInt = strNumberInt.substring(intTelACADMod );
    	                    //console.log('strTelACode ' + strTelACode + ' strNumberInt ' + strNumberInt + ' strTelACodeMod ' + strTelACodeMod);
	                        //};     
	                    };
	                };
	                if ((strNumberInt.length < (intTelMin - intTelACAD)) && ((intTelMin - intTelACAD) > 0)) {
	                    strNumberInt = strNumberInt + '####################';
	                    strNumberInt = strNumberInt.substring(0,(intTelMin - intTelACAD));
	                };  
	                if ((strTelACodeMod.length < (intTelACAD - strTelNDD.length)) && ((intTelACAD - strTelNDD.length) > 0)) {
	                    strTelACodeMod = strTelACodeMod + '##########';
	                    strTelACodeMod = strTelACodeMod.substring(0,(intTelACAD - strTelNDD.length));
	                };			        
                    strNumberInt = fn_SpaceTelGroup(strNumberInt,intGroup);
	                if (((strTelLocal == 'False') || (strTelLocal == '0'))  && (strTelACodeMod != '')) {
	                    strNumberLoc = '(' + strTelNDD + strTelACodeMod + ') ' + strNumberInt + '';
	                } else {
	                    strNumberLoc = '' + strTelNDD + strTelACodeMod + ' ' + strNumberInt + '';
	                };    
                    strNumberInt = '+' + strTelCode + ' ' + strTelACodeMod + ' ' + strNumberInt;
			        if (max < 16) {
			            if (settings.delay > 0) {
				            if (timeout) {
					            window.clearTimeout(timeout);
				            };
				            timeout = window.setTimeout(function () {
					            container.html(settings.format.replace(/%1/, (max - el.val().length)));
					            ex_container.html(settings.ex_format.replace(/%intNumber/, strNumberInt).replace(/%locNumber/, strNumberLoc).replace(/%country/, strTelCountryName));
				            }, settings.delay);
			            } else {
				            container.html(settings.format.replace(/%1/, (max - el.val().length)));
				            ex_container.html(settings.ex_format.replace(/%intNumber/, strNumberInt).replace(/%locNumber/, strNumberLoc).replace(/%country/, strTelCountryName));
			            };
			        } else {
			            container.html('');
			            ex_container.html(settings.ex_format.replace(/%intNumber/, strNumberInt).replace(/%locNumber/, strNumberLoc).replace(/%country/, strTelCountryName));			        
			        };     
			    } else {
			        container.html('');
			        ex_container.html('');
			    };
			} else {
		        container.html('');
		        ex_container.html('');
		    }; 
		};
		
		function pulse(el, again) {
			if (p) {
				window.clearTimeout(p);
				p = null;
			};
			el.animate({ opacity: 0.1 }, 100, function () {
				$(this).animate({ opacity: 1.0 }, 100);
			});
			if (again) {
				p = window.setTimeout(function () { pulse(el) }, 200);
			};
		};
		
        function fn_SpaceTelGroup(strTelToSpace, intGroup) {
            var intCharCount = 0;
            var intCharInsert = '';
	        var strSpacedTel = '';
	        var intTelLength = 0;
	        strSpacedTel = '';
	        strTelToSpace = strTelToSpace.replace(/ /g,"");
	        strTelToSpace = strTelToSpace.replace(/-/g,"");	
        	
	        if ((strTelToSpace + '' != '') && (intGroup > 0)) {
                intTelLength = strTelToSpace.length;
                if (intTelLength > intGroup) {
                    intCharInsert = 0;
                    intCharCount = 0;
                    while(intCharCount < intTelLength) {
                        intCharCount = intCharCount + 1;
                        intCharInsert = intCharInsert + 1;
                        strSpacedTel = strTelToSpace.substring(intTelLength - intCharCount,intTelLength - intCharCount + 1) + strSpacedTel;
                        if (intCharInsert == intGroup) {
                            strSpacedTel = ' ' + strSpacedTel;
                            intCharInsert = 0;
                        };
                    }
                } else {
	                strSpacedTel = strTelToSpace;
	            };
	            strSpacedTel = strSpacedTel.replace(/^\s+|\s+$/g,"");
	        } else {
                strSpacedTel = strTelToSpace.replace(/^\s+|\s+$/g,"");
            };
	        return strSpacedTel;
        };		
		
		return this.each(function () {
			var ex_container = (!settings.ex_container.match(/^<.+>$/)) 
				? $(settings.ex_container) 
				: $(settings.ex_container)
					.insertAfter(this)
					.addClass(settings.classname);	
			var container = (!settings.container.match(/^<.+>$/)) 
				? $(settings.container) 
				: $(settings.container)
					.insertAfter(this)
					.addClass(settings.classname);
			$(this)
				.bind("keydown", function () { count(this, container, ex_container); })
				.bind("keypress", function () { count(this, container, ex_container); })
				.bind("keyup", function () { count(this, container, ex_container); })
				.bind("focus", function () { count(this, container, ex_container); })
				.bind("mouseover", function () { count(this, container, ex_container); })
				.bind("mouseout", function () { count(this, container, ex_container); })
				.bind("paste", function () { 
					var me = this;
					setTimeout(function () { count(me, container, ex_container); }, 10);
				});
			if (this.addEventListener) {
				this.addEventListener('input', function () { count(this, container, ex_container); }, false);
			};
			count(this, container, ex_container);		
		});
	};

})(jQuery);

//spon_rotator

$(document).ready(function() {
    //window.loadFirebugConsole() 
    function fn_RotateSponsors() {
        var strSponIDsToUpdate = '';
        $('.spon_rotator').each(function() {
            var objSponRotator = $(this);
            var strSponRotatorID = objSponRotator.attr("id");
            if (strSponRotatorID.length > 0) {
                var intSponRotatorContainer = $('#' + strSponRotatorID + ' .sp_rot_container').length;
                //console.log("intSponRotatorContainer:" + intSponRotatorContainer);
                $('#' + strSponRotatorID + ' .sp_rot_container').each(function() {
                    var objSponRotatorContainer = $(this);
                    var strSponRotatorContainerID = objSponRotatorContainer.attr("id");
                    //console.log('Container:'+strSponRotatorContainerID);
                    $('#' + strSponRotatorContainerID + ' .sp_rot_item').hide().appendTo('#' + strSponRotatorID);         
                });
                $('#' + strSponRotatorID + ' .sp_rot_item').each(function() {
                    if (intSponRotatorContainer > 0) {
                        intSponRotatorContainer = intSponRotatorContainer - 1;
                        var objSponRotatorItemNext = $(this);
                        //console.log(intSponRotatorContainer,objSponRotatorItemNext);                    
                        objSponRotatorItemNext.show();
                        if (objSponRotatorItemNext.is('.sp_rot_ajax_update')) {
                            strSponIDsToUpdate += '|' + objSponRotatorItemNext.attr("id") + '|';
                            objSponRotatorItemNext.removeClass('sp_rot_ajax_update');
                        }
                        objSponRotatorItemNext.appendTo($('#' + strSponRotatorID + ' .sp_rot_container:first'));
                    };
                });
            };
        });
        if (strSponIDsToUpdate != '') {
            //console.log('Ajax Update', strSponIDsToUpdate);
            $.get('/secure-server/action/get_JSON_sponsor.asp', { update: strSponIDsToUpdate, bitReturn: 0 });        
        };
    };
    //$('#ctl_fn_RotateSponsors').show().click(fn_RotateSponsors);
    window.setInterval(fn_RotateSponsors,15000);
});

/******
 *
 * JSON Ajax Select Builder
 *
 ******/

var jJSON = {
 getValues: function(obj,num) {
     return jJSON[obj]["values"].slice(0,((num == null) ? jJSON[obj]["values"].length : num));
 },
 getCount: function(obj) {
     return jJSON[obj]["count"];
 },
 fn_buildoptionvalue: function(json,strGroup) {
    response = {
        values: [],
        count: 0
    };
    $.each(json[strGroup],function(i,item) {
        if (item.optionvalue != "undefined") {
            response.count++;
            response.values[i] = item.optionvalue;
        }
    });
    return response;
 },
 fn_buildoptiondisplay: function(json,strGroup) {
    response = {
        values: [],
        count: 0
    };
    $.each(json[strGroup],function(i,item) {
        if (item.optiondisplay != "undefined") {
            response.count++;
            response.values[i] = item.optiondisplay;
        }
    });
    return response;
 }
};

$(document).ready(function() {
    if ($('textarea.css_TextareaExpand').length > 0){
	    $.getScript(strJSAutoGrow,function(){ 
		    $('textarea.css_TextareaExpand').autogrow();
	    },true);
    };
    if ($('div.gmap').length > 0){
	    $.getScript(strJSFACLoc,function(){ 
		    fn_LoadGMapScript();
		    //$('div.gmap').fn_GetLocation(var_fn_LocUpdate);
	    },true);
	};
	if ($('div.css_Modal').length > 0) {
	    $.getScript(strJSSimpleModal,function(){
	    
	    },true);
	};

	$("ul.css_sf-menu").supersubs({
	    minWidth: 12,   // minimum width of sub-menus in em units 
	    maxWidth: 27,   // maximum width of sub-menus in em units 
	    extraWidth: 1     // extra width can ensure lines don't sometimes turn over 
	    // due to slight rounding differences and font-family 
	}).superfish();  // call supersubs first, then superfish, so that subs are 
	// not display:none when measuring. Call before initialising 
	// containing tabs for same reason. 	
	        
});

$(document).ready(function() {

	//Hide (Collapse) the toggle containers on load
	$("div.trigger.hidden").next(".toggle_container").hide(); 

	//Slide up and down on click
	$("div.trigger").click(function(){
		$(this).toggleClass("hidden").next(".toggle_container").slideToggle("slow");
		return false;
		//$(this).toggleClass("hidden");
	});

	$('input[type=text], textarea').simpleWaterMark('watermark');

});

$.getScript = function(url, callback, cache){
    $.ajax({
        type: "GET",
        url: url,
        success: callback,
        dataType: "script",
        cache: cache
    });
};

$(document).ready(function() {
    if (!($.browser.msie && $.browser.version.substr(0, 1) < 7)) {
        $("input.css_Btn,a.css_Btn")
                .bind('mouseover focus', function(event) {
                    $(this).parents('div.css_Btn:eq(0)').addClass("css_BtnOver");
                })
                .bind('mouseout blur', function(event) {
                    $(this).parents('div.css_Btn:eq(0)').removeClass("css_BtnOver");
                })
                .wrap('' +
                    '<div class="css_Btn">' +
                    '<div class="lhs">' +
                    '<div class="rhs">' +
                    '</div>' +
                    '</div>' +
                    '</div>');
        $("input.css_Btn,a.css_Btn").closest('div.css_Btn').addClass("css_Update");
        $("input.css_Btn.css_BtnLink,a.css_Btn.css_BtnLink").closest('div.css_Btn').addClass("css_BtnLink");
        $("input.css_Btn.css_BtnCancel,a.css_Btn.css_BtnCancel").closest('div.css_Btn').addClass("css_BtnCancel");
        $("input.css_Btn.css_BtnBakGreen,a.css_Btn.css_BtnBakGreen").closest('div.css_Btn').addClass("css_BtnBakGreen");
        $("input.css_Btn.css_BtnBakBlue,a.css_Btn.css_BtnBakBlue").closest('div.css_Btn').addClass("css_BtnBakBlue");
        $("input:disabled").closest('div.css_Btn').addClass("css_BtnDisabled");

        $("input.css_Center,a.css_Center").each(function() {
            var intW = $(this).css("width");
            if (intW != "") { $(this).css("paddingLeft", "0").css("paddingRight", "0").closest('div.css_Btn').width(intW); }
            $(this).closest('div.css_Btn').addClass("css_Center");
        });

    };
});


function fn_Rotator() {
    //Set the opacity of all images to 0
    $('div#id_rotator ul li').css({ opacity: 0.0 });

    //Get the first image and display it (gets set to full opacity)
    $('div#id_rotator ul li:first').css({ opacity: 1.0 });

    //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('fn_Rotate()', 40000);
}

function fn_Rotate() {
    //Get the first image
    var objCurrent = ($('div#id_rotator ul li.css_Show') ? $('div#id_rotator ul li.css_Show') : $('div#id_rotator ul li:first'));

    //Get next image, when it reaches the end, rotate it back to the first image
    var objNext = ((objCurrent.next().length) ? ((objCurrent.next().hasClass('css_Show')) ? $('div#id_rotator ul li:first') : objCurrent.next()) : $('div#id_rotator ul li:first'));

    objNext.css({ opacity: 0.0 })
	    .addClass('css_Show')
	    .animate({ opacity: 1.0 }, 1000,
	        function() {
	            objCurrent.css({ opacity: 0.0 });
	        });

    objCurrent.removeClass('css_Show');
};

$(document).ready(function() {
    fn_Rotator();
});
