var m_cCurrentItem = "";
        var text=null;
        var newwindow;
        
        var _loginAttempt = false;
        function trackLogin(e, source)
        {
            if (!_loginAttempt)
            {
                var evt = e ? e.keyCode : 13;
                if (evt == 13) 
                {
                    pageTracker._trackPageview("/Logins/" + source);
                    _loginAttempt = true;
                }
            }
        }
        
        function poptastic(url)
        {
	        newwindow=window.open(url,'name','height=500,width=400,left=100,top=100,resizable=yes,menubar=yes,address=yes,directories=yes,scrollbars=yes,toolbar=yes,status=yes');

	        if (window.focus) {newwindow.focus()}
        }
        
        function showField(dropdown, txtField)
        {
            var myindex  = dropdown.selectedIndex
            var SelValue = dropdown.options[myindex].value
            
            if(SelValue == "1")
            {
                txtField.style.visibility = "visible";
            }
            else
                txtField.style.visibility = "hidden";
        }
        
        function promotionTracker(PromoID)
        {
            try
            {
                var urlPath = location.href.split('/');
                var strUrl = "";   
                
                for (i = 3; i < urlPath.length; i++)
                {
                    strUrl += "/" + urlPath[i];
                }
                
                if (strUrl == "/")
                {
                    strUrl += "default.aspx";
                }
             
                pageTracker._trackPageview("/Promotions/" + PromoID + strUrl);
            }
            catch (e)
            { }
        }
       
        
        function activateField(field)
        {
            field.className = "inputblack";
        }

        function activateField(field, defaultText)
        {
                   if (field.value == defaultText)
                       field.value = "";

            field.className = "inputblack";
        }
        
        function activateFieldPw(field, defaultText)
        {
            field.className = "loginTextboxSmall";
        }
        
        function blurFieldPw(field, defaultText)
        {
            if(field.value == "")
            {
                field.className = "loginTextboxSmallPw";                
            }
        }

        function blurField(field, defaultText)
        {
            if(field.value == defaultText || field.value == "")
            {
                field.className = "inputgray";    
                field.value = defaultText;
            }
        }

        function activateFieldLoginBig(field, defaultText)
        {
                   if (field.value == defaultText)
                       field.value = "";

            field.className = "loginTextbox";
        }
        
        function blurFieldLoginBig(field, defaultText)
        {
            if(field.value == defaultText || field.value == "")
            {
                field.className = "loginTextBox";    
                field.value = defaultText;
            }
        }  
        
        function activateFieldBig(field)
        {
            field.className = "inputblackbig";
        }

        function activateFieldBig(field, defaultText)
        {
                   if (field.value == defaultText)
                       field.value = "";

            field.className = "inputblackbig";
        }

        function blurFieldBig(field, defaultText)
        {
            if(field.value == defaultText || field.value == "")
            {
                field.className = "inputgraybig";    
                field.value = defaultText;
            }
        }

        function activateBillingField(field)
        {
        	if (field.value == field.title)
        		field.value = "";

        	field.className = "txtblack";
        }
        function blurBillingField(field)
        {
        	if (field.value == field.title || field.value == "")
        	{
        		field.className = "";
        		field.value = field.title;
        	}
        }
        
        function ClearBox(objTextBox)
        {
            objTextBox.value="";                        
        }
              
        function ClearBox2(objTextBox)
        {   
            if(objTextBox.value != "")
            {
                text = objTextBox.value;
                objTextBox.value="";
            }
            else
            {
                objTextBox.value=text;
            }
        }
        function SetBox(objTextBox)
        {
            objTextBox.value="email";
        }
        
        function hoverMenuOn(item)
        {
            m_cCurrentItem = item.className;
            item.className = "top_menu_hover";
        }

        function hoverMenuOff(item)
        {
            item.className = m_cCurrentItem;
        }        
        
        function addFlashPromotion(flashitem, image1, image2, image3)
        {
        var so = new SWFObject("/flash/sidebanner.swf", "largebanner", "305", "145", "8", "#336699");

            so.addVariable("image1", image1);
            so.addVariable("image2", image2);
            so.addVariable("image3", image3);                        

            so.addParam("wmode", "transparent");
            so.addParam("allowScriptAccess", "always");
            so.setAttribute("style", ";");
            so.write(flashitem);
        }
       
        
        function doButtonPostBack()
        { 
            alert("Hello Cell PostBack "); 
            var theform; 
            if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
                theform = document.forms["Form1"]; 
            }
            else
            {
                theform = document.Form1; 
            } 
            
            theform.__EVENTTARGET.value = "htmlClientButton"; // Hiddin Button ID
            theform.__EVENTARGUMENT.value = null; 
            theform.submit(); 
        }
        
        function findPos(obj) 
        {
             var curtop = 0;
             if (obj.offsetParent) 
             {           
                curtop = obj.offsetTop
                
                while (obj = obj.offsetParent) 
                {               
                    curtop += obj.offsetTop
                }
             }
             
             return curtop;
        }
        
        function redirectTo(url)
        {
            window.location=url;
            return false;
        }
                

        
        function openPrint(mode)
        {
            qORa = (window.location.href.indexOf('?')==-1) ? '?' : '&';
        
            var printFrame = document.getElementById('printFrame'); //window.frames['printFrame'];
                
            printFrame.src = window.location.href + qORa + "p=1&mode=" + mode;
                    
            //alert(qORa + "p=1&mode=" + mode);
            
//            printFrame.focus(); 
//            printFrame.print(); 
        }   

        //Trigger print on the iframe
        function printFact()
        {
            this.focus(); 
            this.print();            
        } 
        
        function searchSite()
        {
            window.location="/googlesearchresults.aspx";
        }
        
        function globalSearch(e, text)
        {
          var evt = e ? e : window.event;   
          if (evt.keyCode == 13)
          {
            document.location.href = "/googlesearchresults.aspx?qstr=" + Url.encode(text);
            return false;
          }        
        }
        
        function clickButton(e, buttonid)
        {          
          var evt = e ? e : window.event;
          var bt = document.getElementById(buttonid);
          if (bt)
          {          
              if (evt.keyCode == 13)
              {
                if (bt.click)
                {
                  bt.click();                
                } else {
                    var linkID = buttonid.replace(/_/g,"$");
                    __doPostBack(linkID,'');                                    
                    //__doPostBack('ctl00$ctl00$btnLogin$LinkButton1','');                
                    /*
                     var evtClick = document.createEvent('MouseEvents'); 
                     evtClick.initMouseEvent( 
                       'click', 
                        true, 
                        true, 
                        window, 
                        0, 
                        0, 
                        0, 
                        0, 
                        0, 
                        false, 
                        false, 
                        false, 
                        false, 
                        0, 
                        null 
                     ); 
                  
                      bt.dispatchEvent(evtClick);
                      */
                  }
                  return false;
              }
          } 
        }


    var slideShowNumber = 0;
    function animation() 
    {
	    var nav = $('showcase-nav');

	    if (slideShowNumber > nav.getElements('li').length-1) {slideShowNumber = 0;}

	    var fx = new Fx.Morph(nav, {duration: 'long', transition: Fx.Transitions.Sine.easeOut});
	    fx.start().chain(
		    function(){this.start(showshowcase(slideShowNumber));},
		    function(){this.start(pauseAnimation());}
	    );
    }


    function pauseAnimation()
    {
        slideShowNumber = slideShowNumber + 1;    
	    setTimeout(animation, 4000);
    }

    function showshowcase(slideShowNumber) 
    {
	    activatethumbnail(slideShowNumber);
	    var big = 'showcase-' + slideShowNumber + '-big';
	    $('showcase-loader').setStyles({'display':'none'});
	    $('showcase').getElements('.bigimage').each(function(i) 
	    {
		    var el = $(i);
		    var fx = new Fx.Morph(el, {duration: 'long', transition: Fx.Transitions.Sine.easeOut});
    	
		    if (i.get('id') !== big) 
		    {
			    fx.start({'opacity':'0'});
		    }
		    else 
		    {
		        //$('showcase').style.
		        $('showcase').style.height = el.scrollHeight;
                fx.start({'opacity':'1'});
		    }

	    });
	    
    }

    function activatethumbnail(slideShowNumber) 
    {
	    $('showcase-nav').getElements('li').each(function(i,x) {
		    if (x == slideShowNumber) 
		    {
			    i.addClass('active');
		    }
		    else {
			    i.removeClass('active');
		    }
	    });
    }
   
    
    /**
	*
	*  URL encode / decode
	*  http://www.webtoolkit.info/
	*
	**/
    
    var Url = {
 
	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},
 
	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
	
    /**
	*  End Of URL encode / decode
	**/
}