/* Video player function from vp.js */
function oMvsLink(gPV,sGuid,bDck,sMenu,sSubM,sURL,sPL,bRP,bStatic,sList){
	bDck=(bDck==1||bDck==true)?0:Math.min((bDck*1)+1,2);	
	if (gPV.indexOf("http://jeux.sympatico.msn.ca/")<1){gPV+="/64";}
	var sLink="http://g.msn.com/0VD0/"+gPV+"?t="+bDck;
	if (arguments.length>1){
		sLink+=(sList)?"&p="+escape(sList):"";
		sLink+=((sMenu)?("&m="+sMenu+"&mi="+sSubM):"");
		sPL=sGuid+((sPL)?","+sPL:"");
		sLink+=((!bRP)?"&i=":"&r=")+sPL;
	}
	if (bDck){
		var ovp=window.open(sLink,"ovp","width=788,height=598,status=1");
		if (sURL){location.href=sURL;}
	}
	else{
		location.href=sLink;
	}
}

function fnLaunchVideo(url)
{	window.open(url,'event','height=615,width=800,toolbar=no,status=no,menubar=no,scrollbars=no,noresize');
}

function goToPrinterFriendlyPage(sQueryString)
{	window.open('/Bell.Sympatico.CMS/Print.aspx'+sQueryString,'PrintThisPage','height=460,width=685,left=0,top=0,toolbar=no,status=no,menubar=yes,scrollbars=yes,noresize');
}

function launchEmailPage(sQueryString, sPagePath, sPageName, sChannelName)
{
	thePageName = URLencode(sPageName);
	theChannelName = URLencode(sChannelName);
	thePagePath = URLencode(sPagePath);
	
	sQueryString += "&pageName="+thePageName+"&channelName="+theChannelName+"&pagePath="+thePagePath;
	window.open('/Bell.Sympatico.CMS/EmailAFriend.aspx'+sQueryString, 'EmailThisPage', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,history=no,resizable=no,width=450,height=460,left=0,top=0');
}

function URLencode(sStr) 
{   return escape(sStr).replace(/\+/g, '%20').replace(/\"/g,'%22').replace(/\'/g, '%27');
}

function URLexternal(externalURL)
{
	window.location.href = externalURL;
}


/* OnlineOpinion (S3t,1424b) */
/* This product and other products of OpinionLab, Inc. are protected by U.S. Patent No. 6606581, 6421724, 6785717 B1 and other patents pending. */
var custom_var,_sp='../Bell.Sympatico.CMS/PageNotFoundb389.html\\/\\/',_rp='../Bell.Sympatico.CMS/PageNotFoundb389.html',_poE=0.0, _poX=0.0,_sH=screen.height,_d=document,_w=window,_ht=escape(_w.location.href),_hr=_d.referrer,_tm=(new Date()).getTime(),_kp=0,_sW=screen.width;_d.onkeypress=_fK;function _fK(_e){if(!_e)_e=_w.event;var _k=(typeof _e.which=='number')?_e.which:_e.keyCode;if((_kp==15&&_k==12))_w.open('http://www.opinionlab.com/ozone/24-7.asp?referer='+_fC(_ht),'Report','width=370,height=200,resizable=no,copyhistory=no,scrollbars=no');_kp=_k};function _fC(_u){_aT=_sp+',\\/,\\.,-,_,'+_rp+',%2F,%2E,%2D,%5F';_aA=_aT.split(',');for(i=0;i<5;i++){eval('_u=_u.replace(/'+_aA[i]+'/g,_aA[i+5])')}return _u};function O_LC(){_w.open('http://ccc01.opinionlab.com/comment_card.asp?time1='+_tm+'&time2='+(new Date()).getTime()+'&prev='+_fC(escape(_hr))+'&referer='+_fC(_ht)+'&height='+_sH+'&width='+_sW+'&custom_var='+custom_var,'comments','width=535,height=192,screenX='+((_sW-535)/2)+',screenY='+((_sH-192)/2)+',top='+((_sH-192)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no')};function _fPe(){if(Math.random()>=1.0-_poE){O_LC();_poX=0.0}};function _fPx(){if(Math.random()>=1.0-_poX)O_LC()};window.onunload=_fPx;function O_GoT(_p){_d.write('<a href=\'javascript:O_LC()\'>'+_p+'</a>');_fPe()}


/* methods for div tags */
var ie=0;var ie4=0;var ie5=0;var ie6=0;
function ieSniffer()
{
var exclude=1;
var agt=navigator.userAgent.toLowerCase();
var win=0;var mac=0;var lin=1;
if(agt.indexOf('win')!=-1){win=1;lin=0;}
if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
var lnx=0;if(lin){lnx=1;}
var ice=0;
var com=0;var dcm;
var op5=0;var op6=0;var op7=0;
var ns4=0;var ns6=0;var ns7=0;var mz7=0;var kde=0;var saf=0;
if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){
		kde=1;
		ns6=1;
		exclude=0;
		}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof window.opera!="undefined"){
	exclude=0;
	if(agt.indexOf("opera/5")!=-1||agt.indexOf("opera 5")!=-1){op5=1;}
	if(agt.indexOf("opera/6")!=-1||agt.indexOf("opera 6")!=-1){op6=1;}
	if(agt.indexOf("opera/7")!=-1||agt.indexOf("opera 7")!=-1){op7=1;}
	}
else if(typeof document.all!="undefined"&&!kde){
	exclude=0;
	ie=1;
	if(typeof document.getElementById!="undefined"){
		ie5=1;
		if(agt.indexOf("msie 6")!=-1){
			ie6=1;
			dcm=document.compatMode;
			if(dcm!="BackCompat"){com=1;}
			}
		}
	else{ie4=1;}
	}
if(typeof navigator.__ice_version!="undefined"){exclude=1;ie4=0;}
}

ieSniffer();

function setSize( obj_name,width )
{
	if( ie )
	{
		if( document.all )
		{
			var  obj = div_GetObj(obj_name);
			if(  obj )
				obj.style.width = width+"px";
		}
	}
}

var prevWidthsOverlapped = 0;
function overlapppedNoAddtag_leftnav()
{
	if( ie )
	{
		var MAIN_CONTENT_PANEL = div_GetObj("MAIN_CONTENT_PANEL");
		var ADDTAG_PANEL = div_GetObj("ADDTAG_PANEL");
		var DIV_MAIN = div_GetObj( "DIV_MAIN" );
		var DIV_NAV = div_GetObj( "DIV_NAV" );
		
		if( MAIN_CONTENT_PANEL && ADDTAG_PANEL && DIV_NAV )
		{
			var max_size = 620;
			var nav_diff = 130-DIV_NAV.clientWidth;
				max_size+=nav_diff;
			if( ADDTAG_PANEL.clientWidth + MAIN_CONTENT_PANEL.clientWidth > max_size )
			{
				if( ADDTAG_PANEL.clientWidth>max_size-1 )
				{
					MAIN_CONTENT_PANEL.style.width = 1;
				}
				else
				{
					MAIN_CONTENT_PANEL.style.width = max_size - ADDTAG_PANEL.clientWidth;
				}
				if( ADDTAG_PANEL.clientWidth + MAIN_CONTENT_PANEL.clientWidth > max_size )
				{
					DIV_MAIN.style.width = ADDTAG_PANEL.clientWidth + MAIN_CONTENT_PANEL.clientWidth +29+DIV_NAV.clientWidth;	
					ADDTAG_PANEL.style.width = DIV_MAIN.clientWidth - MAIN_CONTENT_PANEL.clientWidth-29-DIV_NAV.clientWidth;
					MAIN_CONTENT_PANEL.style.width = DIV_MAIN.clientWidth - ADDTAG_PANEL.clientWidth-29-DIV_NAV.clientWidth;
				}	
			}
		}
	}
}

function div_GetObj(obj_name)
{ 
	var obj = null;
	if( ie )
	{
		if( document.getElementById )
		{
			obj = document.getElementById(obj_name);
		}
		else
		{
			obj = document.all[obj_name];
		}
	}
	return obj;
}
							
function _DivCSS()
{
	var path = "div_table.css";	
	if( ie )
	{
		path = "div_table_ie.css";
	}
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/Bell.Sympatico.CMS/Styles/'+path+'">');
}


function syncAddTag_leftnav()
{
	if( ie && document.all )
	{
		var ADDTAG_OBJ = div_GetObj( "ADDTAG_OBJ" );
		var ZONE_7 = div_GetObj( "ZONE_7" );
		var ZONE_8 = div_GetObj( "ZONE_8" );
		var ADDTAG_PANEL = div_GetObj( "ADDTAG_PANEL" );
		
		var max = ADDTAG_PANEL.clientWidth;
		if( ADDTAG_OBJ &&  max<ADDTAG_OBJ.clientWidth ) max = ADDTAG_OBJ.clientWidth;
		if( ZONE_7 && max<ZONE_7.clientWidth ) max = ZONE_7.clientWidth;
		if( ZONE_8 && max<ZONE_8.clientWidth ) max = ZONE_8.clientWidth;
		
		var width = ADDTAG_PANEL.style.width;
		var css_width = false;
		if( width.indexOf("px")>-1 )
		{
			width = width.substring(0,width.indexOf("px"));
			css_width = true;
		}
		if( max > width || !css_width)
			checkObjWidth( ZONE_8,max );
		if( max > width || !css_width)
			checkObjWidth( ADDTAG_OBJ,max );
		if( max > width || !css_width)
			checkObjWidth( ZONE_7,max );
	}
}
function checkObjWidth(obj,width)
{ 
	if(ie && obj && obj.clientWidth < width )
	{
		obj.style.width = width;
	}
}

function alignHeight_leftnav()
{
	if( ie )
	{
		var DIV_NAV = div_GetObj( "DIV_NAV" );
		var AUTH_PRESENT = div_GetObj( "AUTH_PRESENT" );
		if( DIV_NAV && AUTH_PRESENT )
			if( DIV_NAV.clientHeight >AUTH_PRESENT.clientHeight  )
				AUTH_PRESENT.style.height = DIV_NAV.clientHeight;	
	}
}

function alignMainDivHeightByDiv_leftnav()
{
	if( ie )
	{
		var DIV_NAV = div_GetObj( "DIV_NAV" );
		var DIV_MAIN = div_GetObj( "DIV_MAIN" );
		var AUTH_PRESENT = div_GetObj( "AUTH_PRESENT" );
		if( DIV_NAV && DIV_MAIN && AUTH_PRESENT)
		{
			if( DIV_NAV.clientWidth > 120 )
			{
				AUTH_PRESENT.style.marginLeft = DIV_NAV.clientWidth/2;
			}
			if(DIV_NAV.clientHeight>0)
				DIV_MAIN.style.height = DIV_NAV.clientHeight;
		}
	}
}


function syncAddTag_topnav()
{
	if( ie && document.all )
	{
		var ADDTAG_OBJ = div_GetObj( "ADTAG_OBJ" );
		var ZONE_7 = div_GetObj( "ZONE_11" );
		var ZONE_8 = div_GetObj( "ZONE_12" );
		var ADDTAG_PANEL = div_GetObj( "ADTAG_PANEL" );
		var max = ADDTAG_PANEL.clientWidth;
		if( ADDTAG_OBJ &&  max<ADDTAG_OBJ.clientWidth ) max = ADDTAG_OBJ.clientWidth;
		if( ZONE_7 && max<ZONE_7.clientWidth ) max = ZONE_7.clientWidth;
		if( ZONE_8 && max<ZONE_8.clientWidth ) max = ZONE_8.clientWidth;
		var width = ADDTAG_PANEL.style.width;
		var css_width = false;
		if( width.indexOf("px")>-1 )
		{
			width = width.substring(0,width.indexOf("px"));
			css_width = true;
		}
		if( max > width || !css_width)
			checkObjWidth( ZONE_8,max );
		if( max > width || !css_width)
			checkObjWidth( ADDTAG_OBJ,max );
		if( max > width || !css_width)
			checkObjWidth( ZONE_7,max );
	}
}

function overlapppedNoAddtag_topnav()
{
	if( ie )
	{
		var MAIN_CONTENT_PANEL = div_GetObj("MAIN_CONTENT_PANEL");
		var ADDTAG_PANEL = div_GetObj("ADTAG_PANEL");
		var DIV_MAIN = div_GetObj("DIV_MAIN");
		if( MAIN_CONTENT_PANEL && ADDTAG_PANEL && DIV_MAIN)
		{
			if( ADDTAG_PANEL.clientWidth + MAIN_CONTENT_PANEL.clientWidth > 749 )
			{
				if( ADDTAG_PANEL.clientWidth>748 )
				{
					MAIN_CONTENT_PANEL.style.width=1;
				}
				else
				{
					MAIN_CONTENT_PANEL.style.width = 749-ADDTAG_PANEL.clientWidth;
					ADDTAG_PANEL.style.width = 749 - MAIN_CONTENT_PANEL.clientWidth;
				}
				if( ADDTAG_PANEL.clientWidth + MAIN_CONTENT_PANEL.clientWidth > 749)
				{
					DIV_MAIN.style.width = MAIN_CONTENT_PANEL.clientWidth + ADDTAG_PANEL.clientWidth+31;
					ADDTAG_PANEL.style.width = DIV_MAIN.clientWidth - MAIN_CONTENT_PANEL.clientWidth-31;
					MAIN_CONTENT_PANEL.style.width = DIV_MAIN.clientWidth - ADDTAG_PANEL.clientWidth-31;
				}	
			}
		}
	}
}
function RegisterOverlapProtection(template)
{
	if( ie && window.onload==null)
	{
		if( template=="top" )
			window.onload = overlapppedNoAddtag_topnav;
		else if( template=="left" )
			window.onload = overlapppedNoAddtag_leftnav;
	}
}
/*... methods for div tags */
