﻿


function maskDebug(msg){
	alert(msg);
}

function showMask(parantBodyPath){
	if(parantBodyPath == null){
		parantBodyPath = top.window.document;
	}
	var newEl = document.createElement('div');
	newEl.id = 'mask';
	
	newEl.setAttribute('style','position:absolute; background-color:#555555; filter:alpha(opacity=40);opacity:.40; top:0px; left:0px; height:1024px; width:1024px; display:none');
	parantBodyPath.body.appendChild(newEl);
	//parantBodyPath.body.insertAdjacentHTML('beforeEnd','<div id="mask" style="position:absolute; background-color:#555555; filter:alpha(opacity=40);opacity:.40; top:0px; left:0px; height:100px; width:100px; display:none "></div>');
	var mask = parantBodyPath.getElementById('mask');
	mask.style.width = parantBodyPath.body.clientWidth;
	mask.style.height = parantBodyPath.body.clientHeight+290;
	
	mask.style.display = 'block';
	

}

function hideMask(parantBodyPath){
	if(parantBodyPath == null){
		parantBodyPath = top.window.document;
	}
	var mask = parantBodyPath.getElementById('mask');
	mask.style.display = 'none';
}

function showLoading(parantBodyPath,imgPath){
	if(parantBodyPath == null){
		parantBodyPath = top.window.document;
	}
	showMask(parantBodyPath);
	if(imgPath == null)
		imgPath = '../images/loading.gif';

    var newEl = document.createElement('div');
	newEl.id = 'loadImage';
	newEl.setAttribute('style','position:absolute;');
	newEl.innerHTML = '<img src="'+ imgPath +'">';
	parantBodyPath.body.appendChild(newEl);
	
	//parantBodyPath.body.insertAdjacentHTML('beforeEnd','<div id="loadImage" style="position:absolute;"><img src="'+ imgPath +'"></div>');
	
	var loadImage = parantBodyPath.getElementById('loadImage');
	loadImage.style.top = (parantBodyPath.body.clientHeight/2 - 17);
	loadImage.style.left = (parantBodyPath.body.clientWidth/2 - 17);
	loadImage.style.width = '35px';
	loadImage.style.height = '35px';
	loadImage.style.display = 'block';
}

function hideLoading(parantBodyPath){
	if(parantBodyPath == null){
		parantBodyPath = top.window.document;
	}
	hideMask(parantBodyPath);
	var loadImage = parantBodyPath.getElementById('loadImage');
	loadImage.style.display = 'none';
}

function testCookies(){
    setCookie("testCookie","testData");
    var c = getCookie("testCookie");
    if( c.length < 1 ){
      
             var newdiv = document.createElement('div'); 
             var divIdName = 'testDiv'; 
             newdiv.setAttribute('id',divIdName); 
             newdiv.style.width = "700px"; 
             newdiv.style.height = "700px"; 
             newdiv.style.left = "150px"; 
             newdiv.style.top = "100px"; 
             newdiv.style.position = "absolute"; 
             newdiv.style.background = "white"; 
             newdiv.style.border = "4px solid #000"; 
             newdiv.style.padding="30px 30px";
             var doctype= '<div align="right"><a  style="text-align-last:left;text-decoration:none;color:red;font-weight:bold" href="http://bcs.bedfordstmartins.com/audioreviews" id="closebtn">Close</a></div>'
             +'<p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">Your browser may be blocking pop-ups and/or cookie on the Audio Reviews website. To disable your pop-up blocker and enable cookies, follow the steps for your specific browser:</p>'
             + '<h3>Internet Explorer 6.0</h3>'
             +' <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +' <li>Open the <b>Tools</b> menu and click on <b>Internet Options</b>.</li>'
             +' <li>Select the <b>Privacy</b> tab along the top to remove the checkmark from beside the &#x201C;Block Popup Windows&#x201D; option.</li>'
             +'  <li>Click the Default button (or manually slide the bar down to "Medium").</li>'
             +'   <li>Click the OK button.</li>'
             +'   <li>Reload the page.</li>'
             +'   </ol>'
             +'   <h3>Internet Explorer 7.0</h3>'
             +'     <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Under <b>Tools</b> in the toolbar, select &quot;Pop-up Blocker&quot; </li>'
             +'     <li>Opt to &quot;Turn off pop-up blocker&quot; from the slide-out menu.</li>'
             +'    <li>Click the Privacy tab.</li>'
             +'   <li>Click the Default button (or manually slide the bar down to "Medium").</li>'
             +'   <li>Click the OK button.</li>'
             +'  <li>Reload the page.</li>'
             +'   </ol>'
             +'  <h3>Mozilla Firefox</h3>'
             +'  <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Open the <b>Tools</b> menu and click on <b>Options</b>.</li>'
             +'   <li>Select the &#x201C;Web Features&#x201D; icon in the list on the left to remove the checkmark from beside the &#x201C;Block Popup Windows&#x201D; option.</li>'
             +'    <li>Click the Privacy tab.</li>'
             +'    <li>Select the "Accept cookies from sites" checkbox.</li>'
             +'        <li>Click the OK button.</li>'
             +'       <li>Reload the page.</li>'
             +'           </ol>'
             +'   <h3>Safari</h3>'
             +'   <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Open the <b>Safari</b> menu and select the <b>Preferences</b> option.</li>'
             +'   <li>In the window that displays, click on the &#x201C;Security&#x201D; option to remove the checkmark from the &#x201C;Block pop-up windows&#x201D; option.</li>'
             +'   <li>In the "Accept Cookies" section, select Always.</li>'
             +'  <li>Click OK.</li>'
             +'    <li>Reload the page.</li>'
             +'  </ol>'
             +'  <p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">Please visit our <a style="text-decoration:none;color:#FF6633;font-weight:bold" href="http://www.bedfordstmartins.com/newcatalog.aspx?page=support/student.html" target=_blank class="articlecrosslink">support page</a> for more information.</p>'
             +'  <p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'  Still having trouble? <a style="text-decoration:none;color:#FF6633;font-weight:bold" href="http://www.bedfordstmartins.com/newcatalog.aspx?page=support/techsupport.html" target=_blank class="articlecrosslink">Get help</a>.'
             +'  </p>'
             ;
            newdiv.innerHTML=doctype;
            document.body.appendChild(newdiv); 
      // var answer = confirm ("Your browser may be blocking pop-ups and/or cookie on the Audio Reviews website. To disable your pop-up blocker and enable cookies click OK and follow the steps for your specific browser!!");
              //   if (answer)
             // window.location="http://10.113.47.164:1030/popups_and_cookies.html";
           // window.open('http://10.113.47.164:1030/popups_and_cookies.html','ddd','height=1000,width=900');
           
               
                
    }
          
}

function testPopUpBlocker()
{
   if (IsPopupBlocker()) {
	     //window.location="http://10.113.47.164:1030/popups_and_cookies.html";
	       var newdiv = document.createElement('div'); 
             var divIdName = 'testDiv'; 
             newdiv.setAttribute('id',divIdName); 
             newdiv.style.width = "700px"; 
             newdiv.style.height = "700px"; 
             newdiv.style.left = "150px"; 
             newdiv.style.top = "100px"; 
             newdiv.style.position = "absolute"; 
             newdiv.style.background = "white"; 
             newdiv.style.border = "4px solid #000"; 
             newdiv.style.padding="30px 30px";
             var doctype= '<div align="right"><a  style="text-align-last:left;text-decoration:none;color:red;font-weight:bold" href="http://bcs.bedfordstmartins.com/audioreviews" id="closebtn">Close</a></div>'
             +'<p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">Your browser may be blocking pop-ups and/or cookie on the Audio Reviews website. To disable your pop-up blocker and enable cookies, follow the steps for your specific browser:</p>'
             + '<h3>Internet Explorer 6.0</h3>'
             +' <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +' <li>Open the <b>Tools</b> menu and click on <b>Internet Options</b>.</li>'
             +' <li>Select the <b>Privacy</b> tab along the top to remove the checkmark from beside the &#x201C;Block Popup Windows&#x201D; option.</li>'
             +'  <li>Click the Default button (or manually slide the bar down to "Medium").</li>'
             +'   <li>Click the OK button.</li>'
             +'   <li>Reload the page.</li>'
             +'   </ol>'
             +'   <h3>Internet Explorer 7.0</h3>'
             +'     <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Under <b>Tools</b> in the toolbar, select &quot;Pop-up Blocker&quot; </li>'
             +'     <li>Opt to &quot;Turn off pop-up blocker&quot; from the slide-out menu.</li>'
             +'    <li>Click the Privacy tab.</li>'
             +'   <li>Click the Default button (or manually slide the bar down to "Medium").</li>'
             +'   <li>Click the OK button.</li>'
             +'  <li>Reload the page.</li>'
             +'   </ol>'
             +'  <h3>Mozilla Firefox</h3>'
             +'  <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Open the <b>Tools</b> menu and click on <b>Options</b>.</li>'
             +'   <li>Select the &#x201C;Web Features&#x201D; icon in the list on the left to remove the checkmark from beside the &#x201C;Block Popup Windows&#x201D; option.</li>'
             +'    <li>Click the Privacy tab.</li>'
             +'    <li>Select the "Accept cookies from sites" checkbox.</li>'
             +'        <li>Click the OK button.</li>'
             +'       <li>Reload the page.</li>'
             +'           </ol>'
             +'   <h3>Safari</h3>'
             +'   <ol style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'   <li>Open the <b>Safari</b> menu and select the <b>Preferences</b> option.</li>'
             +'   <li>In the window that displays, click on the &#x201C;Security&#x201D; option to remove the checkmark from the &#x201C;Block pop-up windows&#x201D; option.</li>'
             +'   <li>In the "Accept Cookies" section, select Always.</li>'
             +'  <li>Click OK.</li>'
             +'    <li>Reload the page.</li>'
             +'  </ol>'
             +'  <p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">Please visit our <a style="text-decoration:none;color:#FF6633;font-weight:bold" href="http://www.bedfordstmartins.com/newcatalog.aspx?page=support/student.html" target=_blank class="articlecrosslink">support page</a> for more information.</p>'
             +'  <p style="font-family:Verdana,Sans-Serif;font-size:9pt;color:#333333">'
             +'  Still having trouble? <a style="text-decoration:none;color:#FF6633;font-weight:bold" href="http://www.bedfordstmartins.com/newcatalog.aspx?page=support/techsupport.html" target=_blank class="articlecrosslink">Get help</a>.'
             +'  </p>'
             ;
            newdiv.innerHTML=doctype;
            document.body.appendChild(newdiv); 

	     
	     
   } else {
	//alert("Popup blocker NOT detected.");
   }


}

function IsPopupBlocker() {
	var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
	if (oWin==null || typeof(oWin)=="undefined") {
		return true;
	} else {
		oWin.close();
		return false;
	}
}




