/**
* Dreamsocket
*  
* Copyright  2005 Dreamsocket.
* All Rights Reserved.  
*
* This software (the "Software") is the property of Dreamsocket and is protected by U.S. and
* international intellectual property laws. No license is granted with respect to the
* software and users may not, among other things, reproduce, prepare derivative works
* of, modify, distribute, sublicense, reverse engineer, disassemble, remove, decompile,
* or make any modifications of the Software without written permission from Dreamsocket.
* Further, Dreamsocket does not authorize any user to remove or alter any trademark, logo,
* copyright or other proprietary notice, legend, symbol, or label in the Software.
* This notice is not intended to, and shall not, limit any rights Dreamsocket has under
* applicable law.
*  
*/


var CBSVideoUtils = new Object();

// Static Properties
CBSVideoUtils.popoffVideoPlayer = null;
CBSVideoUtils.MINI_WIDTH = 310;
//CBSVideoUtils.MINI_HEIGHT = 370;
CBSVideoUtils.MINI_HEIGHT = 410;
CBSVideoUtils.POPOFF_URL = "";

// Static Methods
CBSVideoUtils.launchPopoff = function(p_categoryId, p_videoStoryIds, p_videoId, p_videoTime, p_videoStatus, p_siteId)
{
	var query = "?";
	var isScrollable = "no";
	var isResizable = "no";

    var _location = document.location.href;
    var _domain = _location.substr(0, _location.indexOf(document.domain) + document.domain.length);
    var _domainParts = _domain.split(".");

    if(_domainParts.length > 2)
        _domain = "http://" + _domain.replace(_domainParts[0] + ".", "");

//	CBSVideoUtils.POPOFF_URL= "http://static.cbslocal.com/CBS/national/htm/videoplayer/" + p_siteId + "/popoff.html";
	CBSVideoUtils.POPOFF_URL = _domain + "/services/popoff.aspx";
//	CBSVideoUtils.POPOFF_URL= "http://" + location.hostname + "/services/popoff.aspx";

	query += "categoryId=" + p_categoryId + "&";
	query += "videoId=" + p_videoId + "&";
	query += "videoPlayStatus=" + p_videoStatus + "&";

	if(p_videoStoryIds != null)
	{		
		query += "videoStoryIds=" + p_videoStoryIds + "&";
	}	
	if(p_videoTime.length != null)
	{		
		query += "videoTime=" + p_videoTime + "&";
	}
	
	
		
	CBSVideoUtils.popoffVideoPlayer = window.open
	(
		CBSVideoUtils.POPOFF_URL + query, 
		"popoffVideoPlayer", 
		"width=" + CBSVideoUtils.MINI_WIDTH + "," +
		"height=" + CBSVideoUtils.MINI_HEIGHT + ", " +
		"scrollbars=" + isScrollable + ", " +
		"resizable=" + isResizable + ", " +
		"menubar=no, location=no, toolbar=no, status=no, directories=no" 
	);
	CBSVideoUtils.popoffVideoPlayer.focus();			
}
