// JavaScript Document

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

//---------------------------------------------------------------------------------//
//Bookmars-
//=========


//window.resizeTo(screen.availWidth,screen.availHeight);
//top.window.moveTo(0,0);
//Initializing Submenu
//window.onload=menuInit;


// Purpose: this program lets you store, display, and expire 
// a cookie with a given name.  Note: use only alphanumeric and
// underscore characters for the cookie name and value

// Global variables 
var cv                               // Value of my cookie
var myCookie                         // Name of my cookie
var allCookies                       // Gets all cookies 

function storeCookie( t ) { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 var cookie = 'BM_' + myCookie + '=' + cv + '; expires=' + expireDate(t) + '; path=/';
 document.cookie = cookie
 BookMark('','showall');
}  //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

function expireBM(input) {
	cv = ''
	if (formBM.BMName.value == '') {
		formBM.BMName.value = unescape(input);
	}
	myCookie = input;
	storeCookie( -100 );
}

function BookMark( string, commit ) {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
 allCookies = document.cookie  
 
 if ( string != '' ) myCookie = encodeMyInput(string);
 if ( myCookie == null ) myCookie = 'No_Name';
 
 if ( commit == 'storeBM' ) {
	  cv = window.location + '';
	  if (opt == "dvd") {
		var cvArray;
		cvArray = cv.split('/tafseer/dvd/');
		cv = '../' + cvArray[1];
	  }  
	  
	  storeCookie(1900);
 } else if ( commit == 'showall' ) {
	  BMTableColumn1.innerHTML = '';
	  var BMarray;
	  BMarray = allCookies.split(';');

	  var k = 0;		  
	  for (var j = 0; j < BMarray.length; j++) {
		BookMarkName = extractSubstring( BMarray[j], 'BM_', '=' );
		BookMarkPage = extractSubstring( BMarray[j], BookMarkName + '=', ';' );
		report = BMTableColumn1;
		if (BookMarkName != -1) {
			report.innerHTML = '<li><a style="float:right; background-color:#FFFFFF;" onClick="javascript: expireBM(\'' + BookMarkName + '\');">Remove</a><span>' + (k+1) + '. <a href=' + BookMarkPage + '>' + unescape(BookMarkName) + '</a></span></li>' + report.innerHTML;
			k++;				
		}
	  }

	 UIloadAutoBookMark();
	 
	 if (report.innerHTML == '') {
		report.innerHTML = '<div align=center>No Bookmark is Added Yet...</div>';
	 } else {
		 report.innerHTML = '<ul>' + report.innerHTML + '</ul>';
	 }

 }
}  //vVVvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

function encodeMyInput(input) {
	encodedHtml = escape(input);
	encodedHtml = encodedHtml.replace(/\//g,"%2F");
	encodedHtml = encodedHtml.replace(/\?/g,"%3F");
	encodedHtml = encodedHtml.replace(/=/g,"%3D");
	encodedHtml = encodedHtml.replace(/&/g,"%26");
	encodedHtml = encodedHtml.replace(/@/g,"%40");
	return encodedHtml;
}
//		unescape(encodeHtml.htmlEncoded.value);

/*Current date script credit: 
JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
*/
function todaysDate () {
	var mydate=new Date()
	var year=mydate.getYear()	
	if (year < 1000)
	year+=1900
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	if (daym<10)
	daym="0"+daym
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	var fulldate = dayarray[day]+", "+montharray[month]+" "+daym+", "+year;
	
	return fulldate;
}

function fillDate(input) {
	if (input.value != '') {
		input.value = input.value + " - (" + todaysDate() + ")";
	} else {
		input.value = todaysDate();
	}
}

//----------------------------------------------------------------------------------------------//
// New UI
//========

function expireDate( nDays ) {       //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	 // nDays                          // No. of days in future to expire 
	 var one_second = 1000   ;          // 1 sec = 1000 milliseconds
	 var one_hour   = 3600 * one_second;
	 var one_day    = 24 * one_hour;
	 var expire     = new Date( (new Date()).getTime() + nDays*one_day) ;
	 return           expire.toGMTString() ;   // Time to expire cookie
}  //

var IDsToFlipToggle = [];
function IDFlipped( IDString ) {
	flag = false;
	for (var i = 0; i < IDsToFlipToggle.length ; i++) {
		if (IDsToFlipToggle[i] == IDString)
		{
			flag = true;	
		}
	}
	return flag;
}

  function toggleDetails(detailId)
  {
  if (detailId) {
	  if (detailId.style.display == "none")
	  {
		detailId.style.display= "";
		if (IDFlipped(detailId.id)) {
			UIstoreClosedID(Days, detailId.id);
		} else {
			UIunsetID(detailId.id);
		}		
	  }
	  else
	  {
		detailId.style.display= "none";
		if (IDFlipped(detailId.id)) {
			UIunsetID(detailId.id);
		} else {
			UIstoreClosedID(Days, detailId.id);
		}	  
	  }
	}
  }

// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  // Extracts 1st substring in 'myString' bounded by 'delim1' and 'delim2'
  // It is OK if the 'delim2' is missing
  function extractSubstring( myString, delim1, delim2 ) {
      var substr1 = myString.split( delim1 )
          if ( substr1 == myString ) return -1     // delim1 not found
      var substr2 = substr1[1].split( delim2 )
      var len1 = substr1[0].length + delim1.length
      var len2 = substr2[0].length
      return myString.substring( len1, len1+len2 )
  } //


// Start of UI Contol
// Auther - Khaksaar
  var Days = 1900;

  function UIstoreClosedID(t, ID) { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	 var cookie = 'UISettings_' + ID + '=none; expires=' + expireDate(t) + '; path=/';
	 document.cookie = cookie;
  }  //

   function UIunsetID( ID ) {
	 UIstoreClosedID( -100, ID );
   }

  function UIloadSettings() {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  allCookies = document.cookie;		  
	  var UIarray;
	  UIarray = allCookies.split(';');		  
	  for (var j = 0; j < UIarray.length; j++) {
		var ID = extractSubstring( UIarray[j], 'UISettings_', '=' );
		if (ID != -1) {
			if (document.getElementById) 
					toggleDetails(document.getElementById(ID));
			else if (document.all) 
					toggleDetails(document.all[ID]);
			else if (document.layers) 
					toggleDetails(document.layers[ID]);
		 }		 
	 }
  }  //

  function UIresetSettings() {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  allCookies = document.cookie;		  
	  var UIarray;
	  UIarray = allCookies.split(';');		  
	  for (var j = 0; j < UIarray.length; j++) {
		var ID = extractSubstring( UIarray[j], 'UISettings_', '=' );
		if (ID != -1) {
			UIunsetID(ID);
			if (document.getElementById) 
					toggleDetails(document.getElementById(ID));
			else if (document.all) 
					toggleDetails(document.all[ID]);
			else if (document.layers) 
					toggleDetails(document.layers[ID]);
		 }
	 }
 	 UIResetforZoom ();
	 UIResetforCropper();
	 UIResetforIFrame();
  }  //
  
  function UIResetforZoom ()
  {
	 document.forms[3].IDsliderValue.value = 1;
	 A_SLIDERS[0].f_setValue(document.forms[3].IDsliderValue.value);
	 UIstoreFormValue(document.forms[3].IDsliderValue, 100, document.forms[3].IDsliderValue.value);
	 MainImage.width = ImageWidth*document.forms[3].IDsliderValue.value;	  
  }
  
  function UIResetforCropper() //
  {
	if (flagCropper==true) {
		MyCroppingEnd();
	}
	UIforceOpenControl(bottomnavdiv);
	UIforceCloseControl(floatdiv);	
	FloatSwitch = false;
  }
  
  function UIResetforIFrame() //Resets Sub-Index iFrame
  {
	var iframe = document.getElementById('formBM').parentNode.parentNode.childNodes[6].childNodes[2];
	if (iframe)
	{
		if (verseValue) 
		{
				UIstoreVerseRawStr(verseValue);
		}
		iframe.src = iframe.src;
	}
  }

  function UIisClosed( ID ) {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  allCookies = document.cookie;		  
	  var UIarray;
	  var flag = false;
	  UIarray = allCookies.split(';');		  
	  for (var j = 0; j < UIarray.length; j++) {
		var CookieID = extractSubstring( UIarray[j], 'UISettings_', '=' );
		if (CookieID == ID.id) {
			flag = true;
		}			 
	 }
	 return flag;
  }  //	

function UIopenControl( ID ) { // Opens only if open settings are stored
	if ((window.top==self && !UIisClosed( ID ))) {
		toggleDetails( ID );
	} 
}

function UIopenControlDelayed( IDString ) { // Opens only if open settings are stored
	if (window.top==self) {
		if (document.getElementById( IDString ) != null) {
			var ID = document.getElementById( IDString );
			ID.style.display="none";
			if (!UIisClosed( ID )) {
				toggleDetails( ID );
			}			
		} else {
			window.setTimeout("UIopenControlDelayed('" + IDString + "')",3);
		}
	}
}

function UIopenControlDVD( ID ) {  // Opens only if open settings are stored
	if (!UIisClosed( ID )) {
		toggleDetails( ID );
	} 
}

function UIforceOpenControl ( ID ) {
	if (ID.style.display == "none") {
		toggleDetails(ID);
	}	
}

function UIforceCloseControl ( ID ) {
	if (ID.style.display != "none") {
		toggleDetails(ID);
	}
}

// ---------------------------------------------Zoom Value Retainer Functions
 function UIloadFormValue(FormElementID) {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  allCookies = document.cookie;		  
	  var UIarray;
	  var FormValueString = '';
	  UIarray = allCookies.split(';');		  
	  for (var j = 0; j < UIarray.length; j++) {		
		var RetrivedValue = extractSubstring( UIarray[j], 'UI' + FormElementID.id + '=', '; expires=' );
		if (RetrivedValue != -1) {
			if (FormValueString != '') {
				FormValueString = FormValueString + ', ';
			}
			FormValueString = FormValueString + RetrivedValue;
	    }
	  }
	  if (FormValueString != '') {
			FormElementID.value = FormValueString;
	  }
 }  //


function UIstoreFormValue(FormElementID, t, FormValueString) { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	 var cookie = 'UI' + FormElementID.id + '=' + FormValueString + '; expires=' + expireDate(t) + '; path=/';
	 document.cookie = cookie;	 
}  //

var ImageWidth = 100;
var ImageHeight = 100;

var SliderLoaded = 0;
function ResizeImage() {
		ImageWidth = MainImage.width;
		ImageHeight = MainImage.height;
		if (ImageWidth > 100 && SliderLoaded != 0) {
			ImageWidth = MainImage.width;
			MainImage.width = ImageWidth*document.forms[3].IDsliderValue.value;
		} else {
			//ImageWidth -= 1;
			window.setTimeout("ResizeImage()",1);			
		}
}

function toggleFloatBar()
{	
	if (flagCropper==true) {
		MyCroppingEnd();
	}
	toggleDetails(bottomnavdiv);
	toggleDetails(floatdiv);
	FloatSwitch = !FloatSwitch;
	CallFloat();	
}

function zoomImage (operation)
{
	if (operation=="+") {
		A_SLIDERS[0].f_setValue(A_SLIDERS[0].n_value + A_SLIDERS[0].n_step);
	}
	if (operation=="-") {
		A_SLIDERS[0].f_setValue(A_SLIDERS[0].n_value - A_SLIDERS[0].n_step);
	}
	updateImage();
}

function updateImage()
{
	if (flagCropper==true) {
		MyCroppingEnd();
	}
	UIstoreFormValue(document.forms[3].IDsliderValue, 100, document.forms[3].IDsliderValue.value);
	MainImage.width = ImageWidth*document.forms[3].IDsliderValue.value;
	
	if (A_SLIDERS[0].n_value >= A_SLIDERS[0].n_maxValue) {
		UIforceCloseControl(BookmarkText);
		UIforceCloseControl(ZoomTrackbar);
		UIforceCloseControl(Toolbar);
		/*
		if (opt == "dvd") {
			UIforceCloseControl(headerFrame);
			UIforceCloseControl(footerFrame);
		}
		*/
	}
}

// End of UI Control

//------------------------------------------------
// Static Keyboard controls (without dynamic strings envolved)
//

var flagCropper=false;
function StaticKeyboardControl(Event) {	

	//alert(getKeyCharCode(event));
	if (getKeyCharCode(Event) == 80 || getKeyCharCode(Event) == 112) { // P
		document.form3.page.focus();
		flag = 1;
		window.event.returnValue = false
	}

	if (getKeyCharCode(Event) == 70 || getKeyCharCode(Event) == 102) { // F
		toggleFloatBar();
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 45 || getKeyCharCode(Event) == 95) { // -
		zoomImage("-");
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 43 || getKeyCharCode(Event) == 61) { // +
		zoomImage("+");
		//flag = 1;
	}
	
	if (getKeyCharCode(Event) == 47 || getKeyCharCode(Event) == 48) { // {0,/}
		UIResetforZoom();
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 65 || getKeyCharCode(Event) == 97) { // A			
		if (opt != "dvd") {
			UIforceOpenControl(Toolbar);
			UIforceOpenControl(BookmarkText);
			UIforceOpenControl(ZoomTrackbar);
			AdjustFloatBarCenter();
			document.tform.CR.focus();
		}
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 72 || getKeyCharCode(Event) == 104) { // H
		if (opt == "dvd") {
			toggleDetails(headerFrame);
			toggleDetails(footerFrame);
		}
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 76 || getKeyCharCode(Event) == 108) { // L
		document.form1.region.focus();
		//flag = 1;
	}
		
	if (getKeyCharCode(Event) == 84 || getKeyCharCode(Event) == 116) { // T
		toggleDetails(Toolbar);
		toggleDetails(BookmarkText);
		toggleDetails(ZoomTrackbar);
		AdjustFloatBarCenter();
		//flag = 1;
	}
	
	
	if (getKeyCharCode(Event) == 82 || getKeyCharCode(Event) == 114) { // R
		UIresetSettings();
		//flag = 1;
	}
	

	if ((getKeyCharCode(Event) == 66 || getKeyCharCode(Event) == 98)) { // B		
		UIforceOpenControl(Toolbar);
		UIforceOpenControl(BookmarkText);
		UIforceOpenControl(ZoomTrackbar);
		AdjustFloatBarCenter();

		UIforceOpenControl(BMDetail);
		
		window.document.formBM.BMName.focus();
		window.event.returnValue = false
	}	

	if (getKeyCharCode(Event) == 67 || getKeyCharCode(Event) == 99) { // C
		if (flagCropper==false)
		{
			MyCroppingStart();
		} else {
			MyCroppingEnd();
		}
		//flag = 1;
	}

	if (getKeyCharCode(Event) == 13) { // Enter
		if (flagCropper==true)
		{
			MyDoCrop();
		}
		//flag = 1;
	}
	
	if (getKeyCharCode(Event) == 83 || getKeyCharCode(Event) == 115) { // S		
		BookMark( todaysDate(), 'storeBM' );
		//flag = 1;			
	}
	

}

// End of Keyboard controls

//for DVD Start........
function switchToVerse (verse, region) {
	// verse needs to be splitted up regionwise to make it quicker...done.
	window.location = 'verse.htm#verse=' + verse;
}
function switchToPage (page, region) {
	var cURL = parent.location.href + "";
	var cURLarray = cURL.split( "dvd" );
	if (cURLarray[1].search(/guide.htm/) == -1) {
		cURL = cURLarray[0] + "dvd/" + region + "/@page=" + page + ".htm";	
	} else {
		cURL = cURLarray[0] + "dvd/" + region + "/guide.htm";
	}
	cURL = cURL.replace("&first","");
	cURL = cURL.replace("&last","");
	cURL = cURL.replace("@region","region");
	
	if (cURL.search(/http\:\/\//) != -1) // Just for online Test...
	{
		cURL = cURL.replace("@","?");
		cURL = cURL.replace(".htm","");
	}
	
	parent.location.href = cURL;
}
//for DVD End........


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}


//---------------Floating Navigation Bar....


/* Script by: www.jtricks.com
 * Version: 20060303
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */


function move_menu()
{
    if (document.layers)
    {
        floating_menu.left = fm_next_x;
        floating_menu.top = fm_next_y;
    }
    else
    {
        floating_menu.style.left = fm_next_x + 'px';
        floating_menu.style.top = fm_next_y + 'px';
    }
}

function compute_shifts()
{
    fm_shift_x = has_inner
        ? pageXOffset
        : has_element
          ? document.documentElement.scrollLeft
          : document.body.scrollLeft;

    if (target_x < 0)
        fm_shift_x += has_inner
            ? window.innerWidth
            : has_element
              ? document.documentElement.clientWidth
              : document.body.clientWidth;
			  
    if (center_x == true)
	{
        target_x = (has_inner
            ? window.innerWidth
            : has_element
              ? document.documentElement.clientWidth
              : document.body.clientWidth)/2 - 50/2 + centeroffset_x; // 252 is half of width of Div
		
		if (!document.all)
		{
//			 target_x -= 300;
		}
	}

    fm_shift_y = has_inner
        ? pageYOffset
        : has_element
          ? document.documentElement.scrollTop
          : document.body.scrollTop;

    if (target_y < 0)
        fm_shift_y += has_inner
            ? window.innerHeight
            : has_element
              ? document.documentElement.clientHeight
              : document.body.clientHeight;

    if (center_y == true)
        target_y = (has_inner
            ? window.innerHeight
            : has_element
              ? document.documentElement.clientHeight
              : document.body.clientHeight)/2 - 220/2 + centeroffset_y;
}



function SetOpacity(value) {
	if (floating_menu.style.filter != undefined) {
		floating_menu.style.filter = 'alpha(opacity=' + value +')';
	} else {
		floating_menu.style.opacity = value * .01;
	}
}

var FloatSwitch = false;

function float_menu()
{
    var step_x, step_y, HTMLString, OpacStep;   

    HTMLString = ''; 
	
    compute_shifts();

    step_x = (fm_shift_x + target_x - fm_next_x)* .2 ;
    if (Math.abs(step_x) < .1)
        step_x = fm_shift_x + target_x - fm_next_x;

    step_y = (fm_shift_y + target_y - fm_next_y) * .2;
    
    if (step_y < 0)
    {
        step_y = 4*step_y;
    }
    
    if (Math.abs(step_y) < .1)
        step_y = fm_shift_y + target_y - fm_next_y;

    if (Math.abs(step_x) > 0 ||
        Math.abs(step_y) > 0)

    {
        fm_next_x += step_x;
        fm_next_y += step_y;
        move_menu();
    }

 
    if (hoverFlag==false) {
        if (fm_next_y > (fm_shift_y + target_y)) {
            OpacStep = ((fm_shift_y + target_y) / fm_next_y);
        } else {
            OpacStep = (fm_next_y / (fm_shift_y + target_y));
        }
            
        if (fm_next_x > (fm_shift_x + target_x)) {
            OpacStep += ((fm_shift_x + target_x) / fm_next_x);
        } else {
            OpacStep += (fm_next_x / (fm_shift_x + target_x));
        }

        OpacStep = (Math.pow(OpacStep/2,500)*55) + 20;
        SetOpacity (OpacStep) ;
    }
	
	if (FloatSwitch) {
    	setTimeout('float_menu()',300);
	}		

};

	var target_x = 0;
	var target_y = 0;
	var centeroffset_x = 0;
	var centeroffset_y = 0;
	
	var has_inner = typeof(window.innerWidth) == 'number';
	var has_element = document.documentElement && document.documentElement.clientWidth;								
	
	var fm_shift_x, fm_shift_y, fm_next_x, fm_next_y;
	var center_x = false; center_y = false;
	
	function CallFloat() {  
		
		if (UIisClosed(Toolbar)) {				
			AdjustFloatBarCenter();
		}
		
		move_bottom_middle();
		compute_shifts();
		float_menu();			
		
		if (document.layers)
		{
			// Netscape 4 cannot perform init move
			// when the page loads.
			fm_next_x = 0;
			fm_next_y = 0;
		} else {
			fm_next_x = fm_shift_x + target_x;
			fm_next_y = fm_shift_y + target_y;
			move_menu();
		}
		if (UIisClosed(Toolbar)) {
			AdjustFloatBarCenter();
		}
	}

function move_bottom_middle()
{
	center_x=true;
	centeroffset_x = -349;
	center_y=false;
	target_y=-27;
}

function AdjustFloatBarCenter() {
	var AdjustAmount = 125;
	centeroffset_x += UIisClosed(Toolbar) ? AdjustAmount: -1*AdjustAmount;
}
//End Floating Navigation Bar


/**
 * This method returns the charCode value of the key pressed.
 */
function getKeyCharCode(Event) 
{
	var key = null;
	if (window.event) {
		//ie
		key = window.event.keyCode;
	} else if (Event.which) {
		key = Event.which;
	}
	return key;
}

// Skipping blank pages section  |-------------------Start

var imageSize = '';
var skipPagetoURL = '';
var skipPageStr = '';

function skipBlank()
{	
	if (ImageWidth > 0) {
		if (eval(imageSize) < .023761*ImageHeight*ImageWidth) 
		{
			skipPageStr = 'This Scanned Page Appears to be Blank.';
			if (skipPagetoURL != '') 
			{
				skipCountDown();
			}
		}
		HeadAlert.innerHTML=skipPageStr;
	} else {
		window.setTimeout("skipBlank()",1);
	}
}

var skipLoop = 4;
function skipCountDown()
{
	var tempStr = '';
	if (skipPagetoURL != '')	{
		
		tempStr = skipPageStr;
		tempStr += "<br>Moving on to <a href='";
		tempStr += skipPagetoURL;
		tempStr += "'>Next Page</a> in ";
		tempStr += skipLoop;
		tempStr += " Seconds.";
		tempStr += " (<a href=# title='Cancel' onclick='javascript:skipBlankStop();'>X</a>)";
		
		HeadAlert.innerHTML = tempStr;
	}
	if (skipLoop > 0)
	{
		skipLoop -= 1;
		setTimeout("skipCountDown()",1000);
	}	else if (skipPagetoURL != '')	{		
		window.location = skipPagetoURL;
	}	
}

function skipBlankStop()
{
	skipPagetoURL = '';
	HeadAlert.innerHTML='';
}

// Skipping blank pages section  |-------------------End


// Client Cookie Fucntion for Verse |----------------Start

  function UIstoreVerseRawStr(str) { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	var tempStr = str;

	var verse = 1;
	if (tempStr.search(/:/) != -1) {
		if (tempStr.split( ":" )[1] != '' && !isNaN(tempStr.split( ":" )[1])) {
			verse = tempStr.split( ":" )[1];
		  	UIstoreVerse(1, verse);
		}
	} else {
		if (tempStr.search(/Verse /) != -1) {			
			verse = tempStr.split( "Verse " )[1];
		  	UIstoreVerse(1, verse);
		}
	}
  }  //

  function UIstoreVerse(t, v) { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	 var cookie = 'Verse_' + v + '=none; expires=' + expireDate(t) + '; path=/';
	 document.cookie = cookie;
  }  //

  function UIunsetVerse( v ) {
	 UIstoreVerse( -100, v );
  }

  function UIloadVerse(ClearAfterLoad) {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  allCookies = document.cookie;		  
	  var UIarray;
	  var flag = false;
	  UIarray = allCookies.split(';');		  
	  for (var j = UIarray.length-1; j >= 0; j--) {
		var v = extractSubstring( UIarray[j], 'Verse_', '=' );
		if (v != -1) {
			if (ClearAfterLoad==true)
			{
				UIunsetVerse(v);
			}
			flag = !flag;
			return 'Verse ' + v;
		}		 
	 }
	 if (!flag) {
		 return flag;
	 }
  }  //

function SetIndexVersetoDefaults ()
{
	if (selectedVerse != false) {
		for (i=0;i<allRegions.length;i++) 
		{
			try
			{
				for (j=0;j<eval('formSI'+allRegions[i]).page.length;j++)
				{
					if (eval('formSI'+allRegions[i]).page.options[j].text==selectedVerse)
					{
						eval('formSI'+allRegions[i]).page.selectedIndex = j;
					}
				}
			}
			catch (error) {	}
		}
	}
}
// Client Cookie Fucntion for Verse |----------------End
	
	
	
// Client side Auto Save Feature |----------------Start

  function UIstoreAutoBookMark() { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
	  var allCookies = document.cookie;		  
	  var UIarray;
	  var cookie;
	  UIarray = allCookies.split(';');		  
	  for (var j = UIarray.length-1; j >= 0; j--) {
		var SavedDate = extractSubstring( UIarray[j], 'AutoBookMark_', '|' );
		var SavedLocation = extractSubstring( UIarray[j], '|', '=none' );
		if (SavedLocation != -1 && SavedDate == todaysDate()) {
		 cookie = 'AutoBookMark_' + SavedLocation + '|' +  todaysDate() + '=none; expires=' + expireDate(-100) + '; path=/';
		 document.cookie = cookie;			
		}
	 }
  
	 var Location	= window.location + '';
	 Location = Location.split('tafseer/')[1];
	 if (Location!='')
	 {
		 cookie = 'AutoBookMark_' + todaysDate() + '|' +  Location + '=none; expires=' + expireDate(30) + '; path=/';
		 document.cookie = cookie;			 
	 }
  }  //  

  function UIloadAutoBookMark() {  // Select Options ^^^^^^^^^^^^^^^^^^^^^^^^^^
	  var allCookies = document.cookie;		  
	  var UIarray;
	  var DisplayCount = 1;
	  var tmpStr = '';
	  UIarray = allCookies.split(';');	  
	  for (var j = UIarray.length-1; j >= 0; j--) {
		var SavedDate = extractSubstring( UIarray[j], 'AutoBookMark_', '|' );
		var SavedLocation = extractSubstring( UIarray[j], '|', '=none' );
		if (SavedDate != -1 && SavedDate != todaysDate() && DisplayCount > 0) {
			tmpStr = '<li style="background:none;"><span align="center">*. <a href="';
			if (opt == "dvd") {
				tmpStr += '..' + '/..' + '/';
			}
			tmpStr += SavedLocation + '">' + SavedDate + ' - (Auto-Saved)</a></span></li>';
			BMTableColumn1.innerHTML += tmpStr;
			DisplayCount--;
		}
	 }
  }  //

// Client side Auto Save Feature  |----------------End


// Client side Print Feature |----------------Start

function MyPrint() {
	setPrintView();
	setTimeout("window.print()",1555);
//	setTimeout("resetPrintView()",10000);
}


var UIPrintIDsState = new Array ();
var TopTableRightDivContent = "";

function setPrintView() {
	var UIPrintIDs = new Array (	"TopTableCenterDiv",
									"TopTableRightDiv",
									"BlueTopBar",
									"TopToolbar",
									"BottomToolbar",
									"floatdiv",
									"headerFrame",
									"footerFrame",
									"Toolbar",
									"BookmarkText",
									"ZoomTrackbar",
									"BottomBlankRow"
													);
	UIPrintIDsState = captureCurrentUIState (UIPrintIDs, "style.display");
	
	MyCroppingEnd();
	
	var MaximumHeight = 650;
	MainImage.height = MaximumHeight;
	MainImage.width = ImageWidth*MaximumHeight/ImageHeight;
	
	TopTableRightDivContent = TopTableRightDiv.innerHTML;
	SetCurrentUI(UIPrintIDs, "style.display", "none");
}

function captureCurrentUIState (IDs, State) {
	var stateArray = new Array ();
	for (i=0;i<IDs.length;i++) {
		stateArray.push(IDs[i] + '.' + State + '=\"' + eval(IDs[i] + '.' + State) + '\"');
	}
	return stateArray;
}

function SetCurrentUI (IDs, State, value) {
	for (i=0;i<IDs.length;i++) {
		eval(IDs[i] + '.' + State + '=\"' + value + '\"');
	}
	setTimeout("AddEndPrint()",7000);
}

function AddEndPrint()	{
	TopTableRightDiv.innerHTML = "<a href=# title='End Print View' onclick='javascript:resetPrintView();' style=\"font-size:9px; color:grey;\">End Print View</a>";
	TopTableRightDiv.style.display="";
}

function resetPrintView() {
	MainImage.width = ImageWidth*document.forms[3].IDsliderValue.value;
	MainImage.height = ImageHeight*document.forms[3].IDsliderValue.value;
	
	TopTableRightDiv.innerHTML = TopTableRightDivContent;
	
	var splitOperator = "=";
	for (i=0;i<UIPrintIDsState.length;i++) {
		eval(UIPrintIDsState[i]);
	}
}
// Client side Print Feature  |----------------End


//-->
