
if (typeof MY10 == "undefined" || !MY10) {
	var MY10 = {};
}

MY10.util = {
	

	pageLink: function(pageUrl, windowName, winProperties){        
	    var winNew = window.open(pageUrl, windowName, 'toolbar=0,status=0,resizable=1');
		
	    
	    if (!winNew) { // the window didnt open... call from flash	      			
			MY10.util.getSwf(swfId).openLinkFromSwf(pageUrl);
	    }
	    else {
	        winNew.focus();
	    }
	},
	
	getSwf: function(id){	   
		if (navigator.appName.indexOf("Microsoft") != -1) {	       
			return window[id];
	    }
	    else {		      
			return document[id];
	  	}
	}	
	
};


/* SHARE FUNCTIONS */
    
    function shareLink(pageUrl, windowName, winProperties) {
        
        var winNew = window.open(pageUrl, windowName, winProperties);
        
        if (! winNew) {
            getSwf(swfId).openWindowFromSwf(pageUrl);
        } else {
            winNew.focus();
        }
    }
    
    
    var url = "http://www.harley-davidson.com/en_US/Content/Pages/Events/Daytona/daytona.html";
    
    function share(service) {
        switch (service) {
            case 'facebook':
            shareFacebook();
            break;
            case 'myspace':
            shareMyspace();
            break;        
            case 'twitter':
            shareTwitter();
            break;
        }
    }
    
    //Share Facebook
    function shareFacebook() {
        var u = url;
        var t = 'Relive Daytona Bike Week 2010 with Harley-Davidson. Check out the photo gallery to see what happened and get ready for the next rally.';
        var finalURL = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t);
        var properties = 'toolbar=0,status=0,width=626,height=436';
        shareLink(finalURL, 'Facebook', properties);
        //hbx
        _hbPageView('Facebook', '/Experience/Events/2010+Daytona+Bike+Week/Social+Sharing/Facebook'); 
    }
    
    //Share MySpace
    function shareMyspace() {
        var bor = '0';
        var ref = url;
        var tar = '_blank';
        var s = '8';
        var alt = 'Daytona Bike Week 2010';
        var a = 'left';
        var p = 'http://www.harley-davidson.com/en_US/Media/images/Content/Pictorial/Events/Daytona/2010/socialMedia_Icon.jpg';
        var i = '<a href=' + ref + '  target=' + tar + '><img src=' + p + ' align=' + a + ' alt=' + alt + ' hspace=' + s + ' border=' + bor + '/></a>';
        var T = 'Daytona Bike Week 2010';
        var C = i + 'Relive Daytona Bike Week 2010 with Harley-Davidson. Check out the photo gallery to see what happened and get ready for the next rally.';
        var U = '';
        var finalURL = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T) + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U);
        var properties = 'width=1024,height=768,scrollbars=yes,resizable=yes,toolbar=no,location=no,menubar=no,directories=no,status=no';
        shareLink(finalURL, 'MySpace', properties);
        //hbx
        _hbPageView('MySpace', '/Experience/Events/2010+Daytona+Bike+Week/Social+Sharing/MySpace');
    }
    
 

    
 //Share Twitter
    function shareTwitter(url, title) {
  var ref = 'http://www.harley-davidson.com/en_US/Content/Pages/Events/Daytona/daytona.html';  
        var tar = '_blank';
        var finalURL = "http://twitter.com/home?status=Relive Daytona Bike Week 2010 with Harley-Davidson. Check out the photo gallery at http://h-d.com/daytona";
        var properties = 'width=1024,height=768,scrollbars=yes,resizable=yes,toolbar=no,location=no,menubar=no,directories=no,status=no';
        shareLink(finalURL, 'Twitter', properties);
        //hbx
        _hbPageView('Twitter', '/Experience/Events/2010+Daytona+Bike+Week/Social+Sharing/Twitter');
    }


