// Created By Brad K
// CI Video function

//function getVideo(url)
//{
//	
//	return '<embed src="' + url + '" allowFullScreen="true" width="540" height="438" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" bgcolor="transparent" wmode="transparent"><param name = "wmode" value="transparent"/> <param name="bgcolor" value="transparent" /></embed>';
//
//}

function getVideoWS(url)
{
	
	return '<embed src="' + url + '" allowFullScreen="true" width="540" height="336" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" bgcolor="transparent" wmode="transparent"><param name = "wmode" value="transparent"/> <param name="bgcolor" value="transparent" /></embed>';

}

function getVideoWSDimensions(url,height,width)
{
	
	return '<embed src="' + url + '" allowFullScreen="true" width="' + width + '" height="' + height + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" bgcolor="transparent" wmode="transparent"><param name = "wmode" value="transparent"/> <param name="bgcolor" value="transparent" /></embed>';

}

function getVideoWSDimensionsCustomPlayer(id,height,width)
{		
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '" id="viddler_' + id + '"><param name="movie" value="http://www.viddler.com/simple/' + id + '/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"/><param name="flashvars" value="autoplay=t" /><embed src="http://www.viddler.com/simple/' + id + '/" width="' + width + '" height="' + height + '" type="application/x-shockwave-flash" allowScriptAccess="always" flashvars="autoplay=t" allowFullScreen="true" name="viddler_' + id + '" wmode="transparent" ></embed></object>';			
}

// Determine browser and version.
 
 var xOrig, yOrig, globalDragId
 
 globalDragId = '';
 
   function Browser() {
   
     var ua, s, i;
   
     this.isIE    = false;
     this.isNS    = false;
     this.version = null;
   
     ua = navigator.userAgent;
   
     s = "MSIE";
     if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
     }
   
     s = "Netscape6/";
     if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
     }
   
     // Treat any other "Gecko" browser as NS 6.1.
   
     s = "Gecko";
     if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
     }
   }
   
   var browser = new Browser();
   
   // Global object to hold drag information.
   
   var dragObj = new Object();
   dragObj.zIndex = 3;
   
   function dragStart(event, id) {
   
     var el;
     var x, y;
   
     // If an element id was given, find it. Otherwise use the element being
     // clicked on.
   
   globalDragId = id;
   
     if (id)
    dragObj.elNode = document.getElementById(id);
     else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;
   
    // If this is a text node, use its parent element.
   
    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
     }
   
     // Get cursor position with respect to the page.
   
     if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
     }
     if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
     }
   

   
     // Save starting positions of cursor and element.
   
     dragObj.cursorStartX = x;
     dragObj.cursorStartY = y;
     dragObj.elStartLeft  = parseInt(dragObj.elNode.offsetLeft, 10);
     dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);
	 
   	// set xOrig and yOrig
	xOrig = dragObj.cursorStartX;
	yOrig = dragObj.cursorStartY;
   
     if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
     if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;
   
     // Update element's z-index.
   
     //dragObj.elNode.style.zIndex = ++dragObj.zIndex;
   
     // Capture mousemove and mouseup events on the page.
   
     if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
     }
     if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
     }
   }
   
   function dragGo(event) {
   
     var x, y;
   
     // Get cursor position with respect to the page.
   
     if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
     }
     if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
     }
   
     // Move drag element by the same amount the cursor has moved.
   
     dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
     dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";
   
     if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
     }
     if (browser.isNS)
    event.preventDefault();
   }
   
   function dragStop(event) {
   
     // Stop capturing mousemove and mouseup events.
   
	 // If an element id was given, find it. Otherwise use the element being
     // clicked on.
   

    //dragObj.elNode = document.getElementById('toplogoHeader');

   
    // If this is a text node, use its parent element.
   
    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
   
   
	// get end x and y position
	 if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
     }
     if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
     }
   
   	if(((xOrig == x) && (yOrig == y)) || (x == '' && y == '')  )
	{
		if (globalDragId == 'toplogoHeader')
		{
			//window.location = "http://www.getsnus.com/index.asp";
		}
	}
   
     if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
     }
     if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
     }
   }

	