function centervideo() {

	var divCenter = document.getElementById("frameVideo");

	if (divCenter != null) {

		var width = 0;
		var height = 0;
		var scrollTop = 0;
		var scrollLeft = 0;

		if (typeof window.innerWidth == "undefined") {
			// Internet Explorer 7
			width = parseInt(document.body.clientWidth);
			height = parseInt(document.body.clientHeight);

			scrollTop = document.body.scrollTop;
			scrollLeft = document.body.scrollLeft;
		} else {
			// Fire Fox
			width = parseInt(window.innerWidth);
			height = parseInt(window.innerHeight);

			scrollTop = window.pageYOffset;
			scrollLeft = window.pageXOffset;
		}

		var leftValue = parseInt(width / 2 - divCenter.offsetWidth / 2)
				+ scrollLeft;
		var topValue = parseInt(height / 2 - divCenter.offsetHeight / 2)
				+ scrollTop;

		if (leftValue < 0) {
			leftValue = 0;
		}
		if (topValue < 0) {
			topValue = 0;
		}
		divCenter.style.left = leftValue + "px";
		divCenter.style.top = topValue + "px";
	}
}

var videosArray = new Array();
	videosArray["expertServ"] = "http://c.brightcove.com/services/viewer/federated_f9?&amp;width=480&amp;height=270&amp;flashID=myExperience&amp;bgcolor=%23FFFFFF&amp;playerID=812734001001&amp;playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&amp;isVid=true&amp;isUI=true&amp;dynamicStreaming=true&amp;autoStart=true&amp;debuggerID=&amp;videoID=873573751001&amp;%40videoPlayer=873573751001"
	videosArray["brakeLes"] = "http://c.brightcove.com/services/viewer/federated_f9?&width=480&height=270&flashID=myExperience&bgcolor=%23FFFFFF&playerID=812734001001&playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&isVid=true&isUI=true&dynamicStreaming=true&autoStart=true&debuggerID=&videoID=885172340001&%40videoPlayer=885172340001";
	videosArray["traveling"] = "http://c.brightcove.com/services/viewer/federated_f9?&amp;width=480&amp;height=270&amp;flashID=myExperience&amp;bgcolor=%23FFFFFF&amp;playerID=812734001001&amp;playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&amp;isVid=true&amp;isUI=true&amp;dynamicStreaming=true&amp;autoStart=true&amp;debuggerID=&amp;videoID=818616528001&amp;%40videoPlayer=818616528001"
	videosArray["vehicleCheckUp"] = "http://c.brightcove.com/services/viewer/federated_f9?&amp;width=480&amp;height=270&amp;flashID=myExperience&amp;bgcolor=%23FFFFFF&amp;playerID=812734001001&amp;playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&amp;isVid=true&amp;isUI=true&amp;dynamicStreaming=true&amp;autoStart=true&amp;debuggerID=&amp;videoID=873421791001&amp;%40videoPlayer=873421791001"
	videosArray["easyTips"] = "http://c.brightcove.com/services/viewer/federated_f9?&amp;width=500&amp;height=470&amp;flashID=myExperience&amp;bgcolor=%23FFFFFF&amp;playerID=863256487001&amp;playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&amp;isVid=true&amp;isUI=true&amp;dynamicStreaming=true&amp;autoStart=true&amp;debuggerID=&amp;videoID=885295627001&amp;%40videoPlayer=885295627001"
	videosArray["oilLifeblood"] = "http://c.brightcove.com/services/viewer/federated_f9?&width=480&height=270&flashID=myExperience&bgcolor=%23FFFFFF&playerID=812734001001&playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&isVid=true&isUI=true&dynamicStreaming=true&autoStart=true&debuggerID=&videoID=885122454001&%40videoPlayer=885122454001"
	videosArray["changeOil"] = "http://c.brightcove.com/services/viewer/federated_f9?&amp;width=480&amp;height=270&amp;flashID=myExperience&amp;bgcolor=%23FFFFFF&amp;playerID=812734001001&amp;playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&amp;isVid=true&amp;isUI=true&amp;dynamicStreaming=true&amp;autoStart=true&amp;debuggerID=&amp;videoID=873421835001&amp;%40videoPlayer=873421835001"
	videosArray["tiresVideo"] = "http://c.brightcove.com/services/viewer/federated_f9?&width=480&height=270&flashID=myExperience&bgcolor=%23FFFFFF&playerID=812734001001&playerKey=AQ~~%2CAAAAvN_rhbE~%2C4CAJSdMCTse8r4Zv2NsvTcWSb_A6g-AQ&isVid=true&isUI=true&dynamicStreaming=true&autoStart=true&debuggerID=&videoID=885115787001&%40videoPlayer=885115787001"
function showFlashVideo(idVideo) {
	var flashVideoHTML = "<object width='486' height='412'>" +
	"<param name='movie' value='" + videosArray[idVideo] + "'>" +
	"<embed id='flash_video' src='" + videosArray[idVideo] + "' width='550' height='400'>" +
	"</embed></object>";
	
	$("#flashVideoPopUp").fadeIn(0, function(){
		$("#flashVideo").html(flashVideoHTML);
	});
	
	if(jQuery.client.os == "Mac"){
		$("#flashVideoPopUp").css('opacity',0.97);
	}
} 

function closeFlashVideoV() {
	$("#flashVideoPopUp").fadeOut();
	$("#flash_video").remove();

}

function showReportV(pathReport) {

	var overlay = document.getElementById("overlayVideo");
	var frameVideo = document.getElementById("frameVideo");
	var Video = document.getElementById("Video");

	var wbody = document.body.clientWidth;

	Video.src = pathReport;
	overlay.style.display = "block";

	overlay.style.width = wbody;
	frameVideo.style.display = "block";

	centervideo();
	setFuntions();
}

function closeReportV() {
	var overlay = document.getElementById("overlayVideo");
	var frameVideo = document.getElementById("frameVideo");
	var Video = document.getElementById("Video");

	Video.src = '/_res/i/spacer.gif';
	frameVideo.style.display = "none";
	overlay.style.display = "none";
}
function setFuntions() {
	window.onscroll = centervideo;
	window.onresize = centervideo;
}
function showVideo() {
	showReportV('http://link.brightcove.com/services/player/bcpid34048076001?bctid=34205886001');
}

var actual_div;
var scrolltop= 0;

function showPopUp(idDiv) {
	actual_div= idDiv;
	scrolltop = $("html").scrollTop();
	var band1=0;
	var band2=0;
	//show the FAQs
	if(idDiv == "faqs_div"){				
		$("#faqsTextPopUp").fadeIn(0, function(){
			 $("#faqsContainer").css("height", "1061px");
			 $("#faqsTextPopUp #faqsContainer #closeBtn").css("top", "30px");
			$("#faqs_div").css("display", "block");					
		    $("#footerDisclaimer").css("margin-bottom", "250px");	
		    	
		});
		
	}
	//shows the Widget Tool
	if(idDiv == "tool_div"){
		$("#faqsTextPopUp").fadeIn(0, function(){	
			$("#faqsContainer").css("height", "400px");			
			$("#ext-gen2").css("height", "auto");
			if($.client.browser == "Explorer" && $.browser.version == 8){
				$("#faqsTextPopUp #faqsContainer #closeBtn").css("top", "23px");
			}else{
				if(jQuery.client.os == "Mac"  && jQuery.client.browser =="Safari" ){
					$("#faqsTextPopUp #faqsContainer #closeBtn").css("top", "21px");
				}else{
					$("#faqsTextPopUp #faqsContainer #closeBtn").css("top", "20px");
				}
			}
			if(jQuery.client.os == "Mac" ){
				//if(jQuery.client.browser =="Safari"){
				//	$(".x-form-field-wrap .x-form-trigger").css("top","0px");
				//}
				if(jQuery.client.browser =="Firefox"){
					$(".x-form-field-wrap .x-form-trigger").css("top","1px");
				}
			}
			
			$("#toolWidget").css("display", "block");
			
		});
		
	}
	window.top.scroll(0,0);	
	resizeWindowPopUp("faqsTextPopUp");	        
	if(jQuery.client.os == "Mac"  && jQuery.client.browser =="Safari" ){
		$("#faqsTextPopUp").css('opacity',0.99999);
	}
	
} 

function closePopUp() {
	if(actual_div == "faqs_div" || actual_div == "tool_div" ){
		if(actual_div == "faqs_div")
			$("#faqs_div").css("display", "none");
		if(actual_div == "tool_div")
			$("#toolWidget").css("display", "none");

		$("#faqsTextPopUp").fadeOut(0,function(){
			 $("#footerDisclaimer").css("margin-bottom", "20px");
			 window.top.scroll(0,scrolltop);
		});		
	}
}
function centerIt(div_name){
	
	
}
function resizeWindowPopUp(div_id){
	 if(!document.getElementById(div_id)){
        div=document.createElement("div");
        div.id=div_id;
        document.body.appendChild(div);
    }
    else{
        div=document.getElementById(div_id);
    }	        	        
    resizeIt(div);	
}



//rezise window properties!
function resizeIt(obj){
    var darksize=layerSizer();
    //obj.style.width=darksize.w+'px';
    //obj.style.height=darksize.h+'px';
    obj.style.display='block';   
}


function layerSizer(){            
    var win={w:0,h:0};
    var viewportwidth;
    var viewportheight;
    var D = document; 
    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight     
    if (typeof window.innerWidth != 'undefined')
    {
        viewportwidth = window.innerWidth,
            viewportheight = Math.max(
                Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
                Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
                Math.max(D.body.clientHeight, D.documentElement.clientHeight)
            );
    }     
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
    else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0)
    {
        viewportwidth = document.documentElement.clientWidth,
            viewportheight = Math.max(
                Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
                Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
                Math.max(D.body.clientHeight, D.documentElement.clientHeight)
            );
    }
    win.w=viewportwidth;
    win.h=viewportheight;
    return win;
}



// window.onload = centervideo;

