﻿function showColor() 
{
 document.getElementById('QuranFont').style.fontFamily = document.getElementById('QuranStyleChange').options[QuranStyleChange.selectedIndex].value;
 document.getElementById('QuranFont').style.fontSize= document.getElementById('QuranFontChange').options[QuranFontChange.selectedIndex].value;

}


function getValue(varname)
{
  // First, we load the URL into a variable
  var url = window.location.href;

  // Next, split the url by the ?
  var qparts = url.split("?");
//alert(qparts.length);
  // Check that there is a querystring, return "" if not
  if (qparts.length == 0)
  {
    return "";
  }

  // Check that there is a querystring, return "" if not
  if (qparts.length == 1)
  {
    return "";
  }

  // Then find the querystring, everything after the ?
  var query = qparts[1];

  // Split the query string into variables (separates by &s)
  var vars = query.split("&");

  // Initialize the value with "" as default
  var value = "";

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++)
  {
    // Split the variable by =, which splits name and value
    var parts = vars[i].split("=");
    
    // Check if the correct variable
    if (parts[0] == varname)
    {
      // Load value into variable
      value = parts[1];

      // End the loop
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");

  // Return the value

  return value;
}


function loadChapters(selValue) {

   	chapter.options.length=114;

chapter.options[0].text="1. Al-Fatiha [7]   سورة الفاتحة   "; chapter.options[0].value="quran.html?sura=1";
chapter.options[1].text="2. Al-Baqara [286]   سورة البقرة   "; chapter.options[1].value="quran.html?sura=2";
chapter.options[2].text="3. Aal-e-Imran [200]   سورة آل عمران   "; chapter.options[2].value="quran.html?sura=3";
chapter.options[3].text="4. An-Nisa [176]   سورة النساء   "; chapter.options[3].value="quran.html?sura=4";
chapter.options[4].text="5. Al-Maeda [120]   سورة المائدة   "; chapter.options[4].value="quran.html?sura=5";
chapter.options[5].text="6. Al-Anaam [165]   سورة الأنعام   "; chapter.options[5].value="quran.html?sura=6";
chapter.options[6].text="7. Al-Araf [206]   سورة الأعراف   "; chapter.options[6].value="quran.html?sura=7";
chapter.options[7].text="8. Al-Anfal [75]   سورة الأنفال   "; chapter.options[7].value="quran.html?sura=8";
chapter.options[8].text="9. At-Taubah [129]   سورة التوبة   "; chapter.options[8].value="quran.html?sura=9";
chapter.options[9].text="10. Yunus [109]   سورة يونس   "; chapter.options[9].value="quran.html?sura=10";
chapter.options[10].text="11. Hud [123]   سورة هود   "; chapter.options[10].value="quran.html?sura=11";
chapter.options[11].text="12. Yusuf [111]   سورة يوسف   "; chapter.options[11].value="quran.html?sura=12";
chapter.options[12].text="13. Ar-Rad [43]   سورة الرعد   "; chapter.options[12].value="quran.html?sura=13";
chapter.options[13].text="14. Ibrahim [52]   سورة إبراهيم   "; chapter.options[13].value="quran.html?sura=14";
chapter.options[14].text="15. Al-Hijr [99]   سورة الحجر   "; chapter.options[14].value="quran.html?sura=15";
chapter.options[15].text="16. An-Nahl [128]   سورة النحل   "; chapter.options[15].value="quran.html?sura=16";
chapter.options[16].text="17. Al-Isra [111]   سورة الإسراء   "; chapter.options[16].value="quran.html?sura=17";
chapter.options[17].text="18. Al-Kahf [110]   سورة الكهف   "; chapter.options[17].value="quran.html?sura=18";
chapter.options[18].text="19. Maryam [98]   سورة مريم   "; chapter.options[18].value="quran.html?sura=19";
chapter.options[19].text="20. Taha [135]   سورة طه   "; chapter.options[19].value="quran.html?sura=20";
chapter.options[20].text="21. Al-Anbiya [112]   سورة الأنبياء   "; chapter.options[20].value="quran.html?sura=21";
chapter.options[21].text="22. Al-Hajj [78]   سورة الحج   "; chapter.options[21].value="quran.html?sura=22";
chapter.options[22].text="23. Al-Mumenoon [118]   سورة المؤمنون   "; chapter.options[22].value="quran.html?sura=23";
chapter.options[23].text="24. An-Noor [64]   سورة النور   "; chapter.options[23].value="quran.html?sura=24";
chapter.options[24].text="25. Al-Furqan [77]   سورة الفرقان   "; chapter.options[24].value="quran.html?sura=25";
chapter.options[25].text="26. Ash-Shuara [227]   سورة الشعراء   "; chapter.options[25].value="quran.html?sura=26";
chapter.options[26].text="27. An-Naml [93]   سورة النمل   "; chapter.options[26].value="quran.html?sura=27";
chapter.options[27].text="28. Al-Qasas [88]   سورة القصص   "; chapter.options[27].value="quran.html?sura=28";
chapter.options[28].text="29. Al-Ankaboot [69]   سورة العنكبوت   "; chapter.options[28].value="quran.html?sura=29";
chapter.options[29].text="30. Ar-Room [60]   سورة الروم   "; chapter.options[29].value="quran.html?sura=30";
chapter.options[30].text="31. Luqman [34]   سورة لقمان   "; chapter.options[30].value="quran.html?sura=31";
chapter.options[31].text="32. As-Sajda [30]   سورة السجدة   "; chapter.options[31].value="quran.html?sura=32";
chapter.options[32].text="33. Al-Ahzab [73]   سورة الأحزاب   "; chapter.options[32].value="quran.html?sura=33";
chapter.options[33].text="34. Saba [54]   سورة سبأ   "; chapter.options[33].value="quran.html?sura=34";
chapter.options[34].text="35. Fatir [45]   سورة فاطر   "; chapter.options[34].value="quran.html?sura=35";
chapter.options[35].text="36. Ya Seen [83]   سورة يس   "; chapter.options[35].value="quran.html?sura=36";
chapter.options[36].text="37. As-Saaffat [182]   سورة الصافات   "; chapter.options[36].value="quran.html?sura=37";
chapter.options[37].text="38. Sad [88]   سورة ص   "; chapter.options[37].value="quran.html?sura=38";
chapter.options[38].text="39. Az-Zumar [75]   سورة الزمر   "; chapter.options[38].value="quran.html?sura=39";
chapter.options[39].text="40. Ghafir [85]   سورة غافر   "; chapter.options[39].value="quran.html?sura=40";
chapter.options[40].text="41. Fussilat [54]   سورة فصلت   "; chapter.options[40].value="quran.html?sura=41";
chapter.options[41].text="42. Ash-Shura [53]   سورة الشورى   "; chapter.options[41].value="quran.html?sura=42";
chapter.options[42].text="43. Az-Zukhruf [89]   سورة الزخرف   "; chapter.options[42].value="quran.html?sura=43";
chapter.options[43].text="44. Ad-Dukhan [59]   سورة الدخان   "; chapter.options[43].value="quran.html?sura=44";
chapter.options[44].text="45. Al-Jathiya [37]   سورة الجاثية   "; chapter.options[44].value="quran.html?sura=45";
chapter.options[45].text="46. Al-Ahqaf [35]   سورة الأحقاف   "; chapter.options[45].value="quran.html?sura=46";
chapter.options[46].text="47. Muhammad [38]   سورة محمد   "; chapter.options[46].value="quran.html?sura=47";
chapter.options[47].text="48. Al-Fath [29]   سورة الفتح   "; chapter.options[47].value="quran.html?sura=48";
chapter.options[48].text="49. Al-Hujraat [18]   سورة الحجرات   "; chapter.options[48].value="quran.html?sura=49";
chapter.options[49].text="50. Qaf [45]   سورة ق   "; chapter.options[49].value="quran.html?sura=50";
chapter.options[50].text="51. Adh-Dhariyat [60]   سورة الذاريات   "; chapter.options[50].value="quran.html?sura=51";
chapter.options[51].text="52. At-tur [49]   سورة الطور   "; chapter.options[51].value="quran.html?sura=52";
chapter.options[52].text="53. An-Najm [62]   سورة النجم   "; chapter.options[52].value="quran.html?sura=53";
chapter.options[53].text="54. Al-Qamar [55]   سورة القمر   "; chapter.options[53].value="quran.html?sura=54";
chapter.options[54].text="55. Al-Rahman [78]   سورة الرحمن   "; chapter.options[54].value="quran.html?sura=55";
chapter.options[55].text="56. Al-Waqia [96]   سورة الواقعة   "; chapter.options[55].value="quran.html?sura=56";
chapter.options[56].text="57. Al-Hadid [29]   سورة الحديد   "; chapter.options[56].value="quran.html?sura=57";
chapter.options[57].text="58. Al-Mujadila [22]   سورة المجادلة   "; chapter.options[57].value="quran.html?sura=58";
chapter.options[58].text="59. Al-Hashr [24]   سورة الحشر   "; chapter.options[58].value="quran.html?sura=59";
chapter.options[59].text="60. Al-Mumtahina [13]   سورة الممتحنة   "; chapter.options[59].value="quran.html?sura=60";
chapter.options[60].text="61. As-Saff [14]   سورة الصف   "; chapter.options[60].value="quran.html?sura=61";
chapter.options[61].text="62. Al-Jumua [11]   سورة الجمعة   "; chapter.options[61].value="quran.html?sura=62";
chapter.options[62].text="63. Al-Munafiqoon [11]   سورة المنافقون   "; chapter.options[62].value="quran.html?sura=63";
chapter.options[63].text="64. At-Taghabun [18] سورة التغابن "; chapter.options[63].value="quran.html?sura=64";
chapter.options[64].text="65. At-Talaq [12]   سورة الطلاق   "; chapter.options[64].value="quran.html?sura=65";
chapter.options[65].text="66. At-Tahrim [12]   سورة التحريم   "; chapter.options[65].value="quran.html?sura=66";
chapter.options[66].text="67. Al-Mulk [30]   سورة الملك   "; chapter.options[66].value="quran.html?sura=67";
chapter.options[67].text="68. Al-Qalam [52]   سورة القلم   "; chapter.options[67].value="quran.html?sura=68";
chapter.options[68].text="69. Al-Haaqqa [52]   سورة الحاقة   "; chapter.options[68].value="quran.html?sura=69";
chapter.options[69].text="70. Al-Maarij [44]   سورة المعارج   "; chapter.options[69].value="quran.html?sura=70";
chapter.options[70].text="71. Nooh [28]   سورة نوح   "; chapter.options[70].value="quran.html?sura=71";
chapter.options[71].text="72. Al-Jinn [28]   سورة الجن   "; chapter.options[71].value="quran.html?sura=72";
chapter.options[72].text="73. Al-Muzzammil [20]   سورة المزمل   "; chapter.options[72].value="quran.html?sura=73";
chapter.options[73].text="74. Al-Muddathir [56]   سورة المدثر   "; chapter.options[73].value="quran.html?sura=74";
chapter.options[74].text="75. Al-Qiyama [40]   سورة القيامة   "; chapter.options[74].value="quran.html?sura=75";
chapter.options[75].text="76. Al-Insan [31]   سورة الإنسان   "; chapter.options[75].value="quran.html?sura=76";
chapter.options[76].text="77. Al-Mursalat [50]   سورة المرسلات   "; chapter.options[76].value="quran.html?sura=77";
chapter.options[77].text="78. An-Naba [40]   سورة النبأ   "; chapter.options[77].value="quran.html?sura=78";
chapter.options[78].text="79. An-Naziat [46]   سورة النازعات   "; chapter.options[78].value="quran.html?sura=79";
chapter.options[79].text="80. Abasa [42]   سورة عبس   "; chapter.options[79].value="quran.html?sura=80";
chapter.options[80].text="81. At-Takwir [29]   سورة التكوير   "; chapter.options[80].value="quran.html?sura=81";
chapter.options[81].text="82. AL-Infitar [19]   سورة الإنفطار   "; chapter.options[81].value="quran.html?sura=82";
chapter.options[82].text="83. Al-Mutaffifin [36]   سورة المطففين   "; chapter.options[82].value="quran.html?sura=83";
chapter.options[83].text="84. Al-Inshiqaq [25]   سورة الانشقاق   "; chapter.options[83].value="quran.html?sura=84";
chapter.options[84].text="85. Al-Burooj [22]   سورة البروج   "; chapter.options[84].value="quran.html?sura=85";
chapter.options[85].text="86. At-Tariq [17]   سورة الطارق   "; chapter.options[85].value="quran.html?sura=86";
chapter.options[86].text="87. Al-Ala [19]   سورة الأعلى   "; chapter.options[86].value="quran.html?sura=87";
chapter.options[87].text="88. Al-Ghashiya [26]   سورة الغاشية   "; chapter.options[87].value="quran.html?sura=88";
chapter.options[88].text="89. Al-Fajr [30]   سورة الفجر   "; chapter.options[88].value="quran.html?sura=89";
chapter.options[89].text="90. Al-Balad [20]   سورة البلد   "; chapter.options[89].value="quran.html?sura=90";
chapter.options[90].text="91. Ash-Shams [15]   سورة الشمس   "; chapter.options[90].value="quran.html?sura=91";
chapter.options[91].text="92. Al-Lail [21]   سورة الليل   "; chapter.options[91].value="quran.html?sura=92";
chapter.options[92].text="93. Ad-Dhuha [11]   سورة الضحى   "; chapter.options[92].value="quran.html?sura=93";
chapter.options[93].text="94. Al-Inshirah [8]   سورة الشرح   "; chapter.options[93].value="quran.html?sura=94";
chapter.options[94].text="95. At-Tin [8]   سورة التين   "; chapter.options[94].value="quran.html?sura=95";
chapter.options[95].text="96. Al-Alaq [19]   سورة العلق   "; chapter.options[95].value="quran.html?sura=96";
chapter.options[96].text="97. Al-Qadr [5]   سورة القدر   "; chapter.options[96].value="quran.html?sura=97";
chapter.options[97].text="98. Al-Bayyina [8]   سورة البينة   "; chapter.options[97].value="quran.html?sura=98";
chapter.options[98].text="99. Al-Zalzala [8]   سورة الزلزلة   "; chapter.options[98].value="quran.html?sura=99";
chapter.options[99].text="100. Al-Adiyat [11]   سورة العاديات   "; chapter.options[99].value="quran.html?sura=100";
chapter.options[100].text="101. Al-Qaria [11]   سورة القارعة   "; chapter.options[100].value="quran.html?sura=101";
chapter.options[101].text="102. At-Takathur [8]   سورة التكاثر   "; chapter.options[101].value="quran.html?sura=102";
chapter.options[102].text="103. Al-Asr [3]   سورة العصر   "; chapter.options[102].value="quran.html?sura=103";
chapter.options[103].text="104. Al-Humaza [9]   سورة الهمزة   "; chapter.options[103].value="quran.html?sura=104";
chapter.options[104].text="105. Al-fil [5]   سورة الفيل   "; chapter.options[104].value="quran.html?sura=105";
chapter.options[105].text="106. Quraish [4]   سورة قريش   "; chapter.options[105].value="quran.html?sura=106";
chapter.options[106].text="107. Al-Maun [7]   سورة الماعون   "; chapter.options[106].value="quran.html?sura=107";
chapter.options[107].text="108. Al-Kauther [3]   سورة الكوثر   "; chapter.options[107].value="quran.html?sura=108";
chapter.options[108].text="109. Al-Kafiroon [6]   سورة الكافرون   "; chapter.options[108].value="quran.html?sura=109";
chapter.options[109].text="110. An-Nasr [3]   سورة النصر   "; chapter.options[109].value="quran.html?sura=110";
chapter.options[110].text="111. Al-Masadd [5]   سورة المسد   "; chapter.options[110].value="quran.html?sura=111";
chapter.options[111].text="112. Al-Ikhlas [4]   سورة الإخلاص   "; chapter.options[111].value="quran.html?sura=112";
chapter.options[112].text="113. Al-Falaq [5]   سورة الفلق   "; chapter.options[112].value="quran.html?sura=113";
chapter.options[113].text="114. An-Nas [6]   سورة الناس   "; chapter.options[113].value="quran.html?sura=114";

var sura = getValue("sura");

if(sura == "")
sura = 1;

chapter.options[sura-1].selected = true;

}


function loadFont() {

fontName.options.length=14;

fontName.options[0].text="Traditional Arabic"; fontName.options[0].value="Traditional Arabic";
fontName.options[1].text="Simplified Arabic"; fontName.options[1].value="Simplified Arabic";
fontName.options[2].text="Titr"; fontName.options[2].value="Titr";
fontName.options[3].text="Sajid Heading"; fontName.options[3].value="UL Sajid Heading";
fontName.options[4].text="Andalus"; fontName.options[4].value="Andalus";
fontName.options[5].text="Rabia Led"; fontName.options[5].value="UL Rabia Led";
fontName.options[6].text="Bilal Outline"; fontName.options[6].value="UL Bilal Outline";
fontName.options[7].text="Amjad"; fontName.options[7].value="UL Amjad";
fontName.options[8].text="Diwani Bent"; fontName.options[8].value="Diwani Bent";
fontName.options[9].text="Diwani Shaded"; fontName.options[9].value="Diwani Outline Shaded";
fontName.options[10].text="Diwani Outline 1"; fontName.options[10].value="Diwani Simple Outline";
fontName.options[11].text="Diwani Outline 2"; fontName.options[11].value="Diwani Simple Outline 2";
fontName.options[12].text="Diwani Striped"; fontName.options[12].value="Diwani Simple Striped";
fontName.options[13].text="Diwani Letter"; fontName.options[13].value="Diwani Letter";

fontName.options[0].selected = true;

var font = getValue("font");

if(font == "")
font = "Traditional Arabic";

if(font == "Traditional Arabic")
fontName.options[0].selected = true;
else if(font == "Simplified Arabic")
fontName.options[1].selected = true;
else if(font == "Titr")
fontName.options[2].selected = true;
else if(font == "UL Sajid Heading")
fontName.options[3].selected = true;
else if(font == "Andalus")
fontName.options[4].selected = true;
else if(font == "UL Rabia Led")
fontName.options[5].selected = true;
else if(font == "UL Bilal Outline")
fontName.options[6].selected = true;
else if(font == "UL Amjad")
fontName.options[7].selected = true;
else if(font == "Diwani Bent")
fontName.options[8].selected = true;
else if(font == "Diwani Outline Shaded")
fontName.options[9].selected = true;
else if(font == "Diwani Simple Outline")
fontName.options[10].selected = true;
else if(font == "Diwani Simple Outline 2")
fontName.options[11].selected = true;
else if(font == "Diwani Simple Striped")
fontName.options[12].selected = true;
else if(font == "Diwani Letter")
fontName.options[13].selected = true;
else
fontName.options[0].selected = true;
}


function loadSize() {

fontSize.options.length=7;

fontSize.options[0].text="1"; fontSize.options[0].value="20pt";
fontSize.options[1].text="2"; fontSize.options[1].value="25pt";
fontSize.options[2].text="3"; fontSize.options[2].value="30pt";
fontSize.options[3].text="4"; fontSize.options[3].value="35pt";
fontSize.options[4].text="5"; fontSize.options[4].value="40pt";
fontSize.options[5].text="6"; fontSize.options[5].value="45pt";
fontSize.options[6].text="7"; fontSize.options[6].value="50pt";

fontSize.options[0].selected = true;

var size = getValue("size");

if(size == "")
size = 1;

fontSize.options[size-1].selected = true;

}


