/*
EXAMPLE OF AN IMPLEMENTATION (opens syndicon demo from the demo portfolio page):-

<a onclick="return openSBXandTrack(this, 1004, 684, 970, 680, 'PP_DEMO', 'Open', 'Syndicom');" rel="nofollow" title="Promoting Social Collaborative Communities" href="http://www.apprivo.com/video_products_in_action?dl=1">LAUNCH ME</a>


FUNTION ARGUMENTS:-
this = references the links href
1004 = shadowbox width
684 = shadowbox height
970 = pop up width
680 = pop up height
'PP_DEMO' = GA tracking category, refers to the page that launched it
'Open' = GA tracking action, should always be set to 'open'
'Syndicom' =  GA tracking label, which in the case of this would most commonly be the company name

rel="nofollow" stops link from acting like normal link and prevents it from going to the link directly
title="..." used for shadowbox title
href="..." is used by shadowbox or pop up... this should be the url of the item you are showing with shadowbox or pop up. Can be an image or html page

CATEGORIES TO USE:
PP_WEB
PP_ELEARN
PP_VIDEO
PP_SALESFORCE
PP_DEMO
PP_PRINT

PP = Portfolio Page

*/


// JavaScript 
var openInShadowBox = false;
var viewportwidth;
var viewportheight;
var sbx = window.Shadowbox;
Shadowbox.init({
players: ['img', 'iframe']
});
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
//document.write('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>');

if (viewportwidth >= 1025 && viewportheight >= 680 ) {
	
	openInShadowBox = true;
	//alert("large screen");
	

} else {
	openInShadowBox = false;
	//alert("small screen");

}


function openSBXandTrack(el, _width, _height, _popUpWidth, _popUpHeight, _label, _action, _identifier){
  
  
  
  pageTracker._trackEvent(_label, _action, _identifier);
  
  if(openInShadowBox){
    sbx.open( { content : el.href
                   , player : 'iframe'
                   , title : el.title||''
                   , width : _width
 				   , height : _height
                   //could include width/height/options if desired
                   }
                );
    return false;
  }else{ 
  	//no Shadowbox in parent window!
  	window.open(el.href,'popUp', 'width='+_popUpWidth+', height='+_popUpHeight+',directories=no,location=no,menubar=no, resizable=no,scrollbars=no, status=no,toolbar=no'); 
    return false;
  }
}


