﻿/* shadowbox launch */
function openShadowbox(shadowID, width, height) {
    Shadowbox.open({
        player: 'inline',
        content: '#' + shadowID + '',
        width: width,
        height: height
        
    }); 
}
/* .shadowbox launch */


window.log = function(){
  log.history = log.history || []; 
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};

//(function(doc){
//  var write = doc.write;
//  doc.write = function(q){ 
//    log('document.write(): ',arguments); 
//    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
//  };
//})(document);


/* Add Bookmark*/
function add_bookmark(url,page_title)
{
	if(window.sidebar) // Firefox / Mozilla
	{ 
		window.sidebar.addPanel(page_title, url,'');
	}
	else if(window.opera) // Opera
	{
		var a = document.createElement('A');
		a.rel = 'sidebar';
		a.target = '_search';
		a.title = page_title;
		a.href = url;
		a.click();
	}
	else if(window.document.all) // IE
	{ 
		window.external.AddFavorite(url, page_title);
	}
	else
	{
		alert('Please press Ctrl+D or Command+D to bookmark');
	}
}

function MM_openBrWindow_(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function openTermsConditions() {
	MM_openBrWindow_( applicationRoot + '/find-rheumatologist/terms.aspx','','width=460,height=420');
}

function goToRequested(url) {
    window.open(url, "_newWin", 'toolbar,menubar,scrollbars,resizable,location');    
    window.close();
}

function add_spotlight(src,type,cat) {
  var tag_url="//fls.doubleclick.net/activityi;src=" + src + ";type=" + type + ";cat=" + cat + ";ord=1;num="+Math.floor(Math.random()*999999)+"?";
  if(document.getElementById("DCLK_FLDiv")){var flDiv=document.getElementById("DCLK_FLDiv");}
  else{var flDiv=document.body.appendChild(document.createElement("div"));flDiv.id="DCLK_FLDiv";flDiv.style.display="none";}
  var DCLK_FLIframe=document.createElement("iframe");
  DCLK_FLIframe.id="DCLK_FLIframe_"+Math.floor(Math.random()*999999);
  DCLK_FLIframe.src=tag_url;
  flDiv.appendChild(DCLK_FLIframe);
}

var results;
function setresult(dataresult) {
    results = dataresult;
   // return results;
}
function getresults(){
return results;
}

function podcastCall(button) {
    if (button == "download") {
        add_spotlight("2644366","humir811","crohn647");
        window.open(applicationRoot + "/common/swf/audio/crohns_2_enjoyeating_030308.mp3", "Mp3", "scrollbars=yes,resizable=no,width=550,height=400");
    }
    if (button == "transcript") {
        add_spotlight("2644366","humir811","crohn031");
        window.open(applicationRoot + "/living-with-crohns/transcripts/enjoying-eating.aspx", "Transcripts", "scrollbars=yes,resizable=no,width=850,height=800");

    }
}

function podcastTrack(event) {
    var s = s_gi(s_account);
    
    if (event == "play") {
        s.linkTrackVars = 'prop14,eVar14,events';
        s.events = 'event20';
        s.prop14 = 'video - Crohns Diet Podcast';
        s.eVar14 = 'video - Crohns Diet Podcast';
        s.linkTrackEvents = 'event20';
    }
    if (event == "pause") {
        s.linkTrackVars = 'prop14,eVar14,events';
        s.events = 'event20';
        s.prop14 = 'video - Crohns Diet Podcast';
        s.eVar14 = 'video - Crohns Diet Podcast';
        s.linkTrackEvents = 'event20';
    }
    if (event == "download") {
        s.linkTrackVars = 'prop15,eVar15,events';
        s.events = 'event21';
        s.prop15 = 'video - Crohns Diet Podcast Download';
        s.eVar15 = 'video - Crohns Diet Podcast Download';
        s.linkTrackEvents = 'event21';
    }
    if (event == "transcript") {
      s.linkTrackVars = 'prop15,eVar15,events';
      s.events = 'event21';
      s.prop15 = 'video - Crohns Diet Podcast Transcript';
      s.eVar15 = 'video - Crohns Diet Podcast Transcript';
      s.linkTrackEvents = 'event21';
  }
  s.trackLink(s.getPageName(), "o", "video - Crohns Diet Podcast");
    
}
