var _ff = false;
var _safari = false;

if(navigator.userAgent.indexOf("Firefox")!=-1)
{
    var versionindex=navigator.userAgent.indexOf("Firefox");
    
    if (versionindex > 1)
    {
        _ff = true;
     }
}

if(navigator.userAgent.indexOf("Safari")!=-1)
{
    var versionindex=navigator.userAgent.indexOf("Safari");
    
    if (versionindex > 1)
    {
        _safari = true;
     }
}

function getElementsByClass(searchClass,node,tag) 
{
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
};

function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
}

function getElementAbsPosX(el)
{
    var dx = 0;
    if (el.offsetParent) {
        dx = el.offsetLeft + 8;
        while (el = el.offsetParent) {
            dx += el.offsetLeft;
        }
    }
    return dx;
}

function findPosY(obj)
{
var curtop = 0;
if(obj.offsetParent)
    while(1)
    {
      curtop += obj.offsetTop;
      if(!obj.offsetParent)
        break;
      obj = obj.offsetParent;
    }
else if(obj.y)
    curtop += obj.y;
return curtop;
}

function getLeft(element) {
	var left = 0, absoluteAncestor = false, computedStyle = (document.defaultView && document.defaultView.getComputedStyle), currentStyle = (element.currentStyle);
//	so long as the element has an positioning context...
	while (element.offsetParent) {
//		add the left offset of the element
		left += element.offsetLeft
//		set the element to the element which provided the positioning context
		element = element.offsetParent;
//		if the element hasLayout (IE-only property)
		if (currentStyle && element.currentStyle.hasLayout && element.nodeName.toLowerCase() != 'html') {
//			add the width of the left border
			left += element.clientLeft;
//			and if it's absolutely positioned, flag that we've got an absolutely positioned ancestor
			if (element.currentStyle['position'] == 'absolute') absoluteAncestor = true;
//		otherwise, if it's a browser that supports computedStyle & the element is absolutely positioned
		} else if (computedStyle && document.defaultView.getComputedStyle(element, "").getPropertyValue('position') == 'absolute') {
//			add the left border of the element
			left += parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue('border-left-width'));
//			and flag that we've got an absolutely positioned ancestor
			absoluteAncestor = true;
		}
	}
//	if the browser supports currentStyle (i.e. is IE) and we found an absolutely positioned ancestor, add any left margin on the BODY
	if (!absoluteAncestor && currentStyle) return left += document.getElementsByTagName('BODY')[0].offsetLeft;
//	otherwise, if we found an absolutely positioned ancestor and the browser supports computed style add any left border from the BODY
	else if (!absoluteAncestor && computedStyle) return left += parseInt(document.defaultView.getComputedStyle(document.getElementsByTagName('BODY')[0], "").getPropertyValue('border-left-width'));
}

/*	GET STYLE
	Based on Ryber Nyman's script at:
	http://www.robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element/
	
	gets the current style (computed style in Moz/Safari/etc.) of an element
	
	PARAMETERS
	element - object, element node reference
	rule - string, CSS rule
	
	KNOWN BUGS
	- if a property is set in percentages, ems, etc., IE will return the
	  value in the same unit in which the property was set, where Firefox,
	  Safari, et al will return the value in pixels (that's the difference
	  between computed style & current style)
	
*/
function getStyle(element, rule){
	var value, dashIndex;
	if (document.defaultView && document.defaultView.getComputedStyle) {
		value = document.defaultView.getComputedStyle(element, "").getPropertyValue(rule);
	} else if (element.currentStyle) {
		while(-1 != (dashIndex = rule.indexOf('-'))) {
			rule = rule.substring(0,dashIndex) + rule.substring(dashIndex + 1, dashIndex + 2).toUpperCase() + rule.substring(dashIndex + 2);
		}
		value = element.currentStyle[rule];
    }
    return value;
}

function popfplayer(identKey)
{
    testwindow= window.open ("/fvideo.aspx?i=" + identKey, "mywindow", "location=0,status=0,scrollbars=0,resizable=0,width=800,height=490");
}
