﻿var DefaultTop=50;
 function hideElement(element_id){
         if (document.getElementById && document.getElementById(element_id) && document.getElementById(element_id).style)
        {
		    document.getElementById(element_id).style.visibility="hidden";
		    document.getElementById(element_id).style.display="none"
        };
 }
    function showElement(element_id){
        if (document.getElementById && document.getElementById(element_id) && document.getElementById(element_id).style)
        {
		    document.getElementById(element_id).style.visibility="visible";
		    document.getElementById(element_id).style.display="block"
        };
 }
function closePopUp(wholeObj){
    
}
function showPopup(bgType, objName, myfullscreen, myTop)
{
    //top.location.hash = "#";	
	document.getElementById(bgType).style.height = window.screen.availHeight + "px"
   var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
   //document.getElementById(bgType).style.top=scrollTop + "px"
    //document.getElementById(objName).style.top=String(Number(scrollTop+50)) +"px"
    showElement(myfullscreen);
   
    //setTimeout("checkscroll('"+objName+ "','" + bgType + "','" + myfullscreen + "','" + myTop +"')",1)
    var selects =document.getElementsByTagName("SELECT")
    for (var i=0;i<selects.length;i++){
        selects[i].style.visibility="hidden"
        selects[i].style.display="none"
    } 
    

 }
 function hidePopup()
 {
 	document.body.parentNode.style.overflow = "";
    var selects =document.getElementsByTagName("SELECT")
     for (var i=0;i<selects.length;i++){
        selects[i].style.visibility="visible"
        selects[i].style.display=""
    }
 }
 function checkscroll(objName, bgType, myfullscreen, myTop)
 {
    if ( document.getElementById(myfullscreen).style.visibility=="visible"){
         var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
         document.getElementById(bgType).style.top=scrollTop + "px"
		 if (myTop==null || myTop=="undefined")
			myTop=DefaultTop;
         document.getElementById(objName).style.top=String(Number(scrollTop)+myTop) +"px"
         setTimeout("checkscroll('"+objName+ "','" + bgType + "','" + myfullscreen +"'," + myTop +")",1)
      }
 }
 
 
 
 function StopVideo(iframe_id){
   	 if (document.getElementById && document.getElementById(iframe_id) && document.getElementById(iframe_id).src)
		{
			document.getElementById(iframe_id).src=""        
		};
}

var ashxLoadControlPath = '../Handlers/LoadControl.ashx';
function LoadVideoControl(extId)
{
    var ashxLoadControl = ashxLoadControlPath;
    var ControlPath = '~/UserControls/DisplayAd.ascx';
    ashxLoadControl += "?rnd=" + Math.random();
    ashxLoadControl += "&SkipLogginTest=1";
    ashxLoadControl += "&ControlPath=" + ControlPath; 
    ashxLoadControl += "&ExternalSrcId=" + extId; 

   
   
    $("#divInnerVideo").load(ashxLoadControl,function(responseText, textStatus, XMLHttpRequest){
//            debugger
//        if(responseText =="")
//            RedirectToLogin();
     });;
}


function LoadVideoControlToTop(extId)
{
    var ashxLoadControl = ashxLoadControlPath;
    var ControlPath = '~/UserControls/DisplayAd.ascx';
    ashxLoadControl += "?rnd=" + Math.random();
    ashxLoadControl += "&SkipLogginTest=1";
    ashxLoadControl += "&ControlPath=" + ControlPath; 
    ashxLoadControl += "&ExternalSrcId=" + extId; 

//   $("#divInnerVideo").load(ashxLoadControl,function(responseText, textStatus, XMLHttpRequest){
  //          $(window.parent.document.getElementById("divInnerVideo"))[0].innerHTML =responseText;
   
    $(window.parent.document.getElementById("divInnerVideo")).load(ashxLoadControl,function(responseText, textStatus, XMLHttpRequest){
           
     });;
}

	function hideVideoFromTop()
	{
        window.parent.document.getElementById("divInnerVideo").innerHTML ="";
   
	    hideElement('fullscreen2');
	    hidePopup();
	}
	