$(function() {
	$("a").each(function() {
		var i = 0;
		if ($(this).attr("href") != undefined) {
		  var href = $(this).attr("href");
		  var text = $(this).text();
		if (href.substr(href.length - 3) == 'flv') {
		  var o = $(this);
		  $(o).attr("id","video" + i);
		  swfobject.embedSWF('/UserFiles/Flash/player.swf', $(this).attr("id"),text.substring(0,text.indexOf('x')), text.substr(text.indexOf('x')+1), "9.0.0",
		  	false, {file:href,autostart:true});
		  $("#wrapper2").height( ($("#wrapper2").height() + parseInt(text.substr(text.indexOf('x')+1)) -15) + 'px');
		}
		}
	});
	window.setTimeout(function() {
		$("#wrapper2").height($("#wrapper3").height() - 48);
		if ($.browser.msie) {
			$("#wrapper2").css("margin-left","-1px");
			$("#wrapper3").css("margin-left","1px");
			if (parseInt($.browser.version, 10) < 8) {
				window.setTimeout(function() {				
					$("#wrapper2").height($("#wrapper3").height() - 48);
					$("#footShadow").css("margin-top","-21px");
				},1000);
			}
		}
	}, 600);	
});

function clearText(field) {
    if (field.value == 'Type Search Here')
    {
        field.value = '';
        field.style.textAlign='left';
    }
}
function showItem(id) {
    document.getElementById(id).style.display = 'block';
}

var mouseX, mouseY;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;

if(ns4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = moveToMouseLoc;


function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  mouseX = x;
  mouseY = y;
  return true;
}
function displayDetails(id,link) {
    var winW, winH;
    if (navigator.appName.indexOf("Microsoft")==-1) {
    winW = window.outerWidth-16;
    winH = window.outerHeight-16;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
    winW = document.body.offsetWidth-20;
    winH = document.body.offsetHeight-20;
    }

    var x;
    document.getElementById(id).style.display='block';
    if ((winW - mouseX) < 275)
        x = winW - 250
    else
        x = mouseX+25;

    document.getElementById(id).style.left = x;

    document.getElementById(id).style.top=mouseY-75;
}
function closeDetails(id,link) {
    document.getElementById(id).style.display='none';
}
