setInterval("showTime()",1000)

function showTime()
{
	var Digital=new Date();
	var theyear=Digital.getFullYear();
	var themonth=Digital.getMonth()+1;
	var thedate=Digital.getDate();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds()
	var day = Digital.getDay();
	var fullday;

	if (day == 1) {fullday = "Monday";} else if (day == 2) {fullday = "Tuesday";} else if (day == 3) {fullday = "Wednesday";} else if (day == 4) {fullday = "Thursday";} else if (day == 5) {fullday = "Friday";} else if (day == 6) {fullday = "Saturday";} else if (day == 0) {fullday = "Sunday";}
	var obj = document.getElementById("dateTimee");
	if (obj != null)
	{
		var datetimee = fullday + ", " + thedate + "-" + themonth + "-" + theyear + ", " + hours + ":" + minutes + ":" + seconds;
		obj.innerText = datetimee + " \r\nLife is getting shorter, shorter, shorter... think about it...";
	}
	obj = document.getElementById("dateTimeeSeconds");
	if (obj != null)
	{
		obj.innerText = seconds;
	}


}

function GetHNOld(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+3);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');
	
	var txtcomments = document.getElementById("txtcomments");
	if (txtcomments != null)
	{
		txtcomments.value = text + "\r\nat following e-mail address.";
	}
	
	var txtToFocus = document.getElementById("txtToFocus");
	if (txtToFocus != null)
	{
		txtToFocus.focus();
	}
	
	var textForGetFrame = text.substring(0,35);
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=hamdonaat="+textForGetFrame;
}

function GetHN(id, obj)
{
	var text = obj.innerHTML;
	text = text.substring(text.indexOf(')')+2);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');
	while (text.indexOf('&nbsp;') > -1)	
		text = text.replace('&nbsp;',' ');
		
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');
		
	var textForGetFrame = text.substring(1,35);

	//Hide all divs of Please wait
	var myDiv;
	for (var i=0; i<59; i++)
	{
		myDiv = document.getElementById("myDiv"+i);
		if (myDiv != null)
			myDiv.className="myDivHid";
	}	

	//Show selected div
	myDiv = document.getElementById("myDiv"+id);
	if (myDiv != null)
	{
		myDiv.className="myDivVis";
		var fileName = "http://e-rinascita.com/faisalmb/scrd/hamdonaat/"+GetHamdoNaatFileName(id);
		var message = "Please wait while downloading is being started. <br /> <a style='color:blue' href='"+fileName+"'>-Or- To Download Right click this blue link then click Save Target/Link As... </a>";
		myDiv.innerHTML = message;
		//var message = "Please wait while downloading is being started. <br /> -Or- To Download Right click following blue link then click Save Target/Link As... <br /><a style='color:blue' href='"+fileName+"'>" +fileName+ "</a>";
	}
	
	this.getFrame.location.href="http://faisalmb.com/web/general/VisitorHN.aspx?hvisit=hamdonaat="+textForGetFrame;
	this.frmGetHN.location.href=fileName;
}


function GetHamdoNaatFileName(id)
{
	     if (id == "1" ) return "Aye Saba Mustafa Se Keh Daina by Siddiq Ismail.mp3";
	else if (id == "2" ) return "Agar Koi Apna Bhala Chahta Hai by Saeed Hashmi.mp3";
	else if (id == "3" ) return "Ah Reh Jati Hay Falak Par by Siddiq Ismail.mp3";
	else if (id == "4" ) return "Alif Allah Chambe Di Booti by Abida Parveen.mp3";
	else if (id == "5" ) return "Allah Names Arabic.mp3";
	else if (id == "6" ) return "Allah Hoo Sami Yousuf 4.mp3";
	else if (id == "7" ) return "Allahoo Allahoo by Muhammad owais raza.mp3";
	else if (id == "8" ) return "Azal Ki Khushboo.mp3";
	else if (id == "9" ) return "Bigri Bhi Banain Ge.mp3";
	else if (id == "10") return "Faslon Ko Takalluf Hai by waheed zafar.mp3";
	else if (id == "11") return "Gul As Ru Khata by Um E Habiba.mp3";
	else if (id == "12") return "Ishaq Ko Husun Ke Andaz 3.mp3";
	else if (id == "13") return "Jab Zaban Par Muhammad (saws) Ka Naam A Gia by Um E Habiba.mp3";
	else if (id == "14") return "Jahan Roza E Pak Khair Ul Wara by waheed zafar.mp3";
	else if (id == "15") return "Jashan E Amad E Rasool sallallahoalaihiwassallam.mp3";
	else if (id == "16") return "Kabay Pa Pari Jab Phehli Nazar by Um E Habiba.mp3";
	else if (id == "17") return "Khuda Ka Zikar Karain by zafar qasmi.mp3";
	else if (id == "18") return "Koie Tou Hai Jo Nizam E Hasti Chala Raha Hai Wohi Allah hay.mp3";
	else if (id == "19") return "Madinay Ka Safar Hay by Siddiq Ismail.mp3";
	else if (id == "20") return "Madni Ra Madni Ra by um e habiba.mp3";
	else if (id == "21") return "Makkay Ki Fazaon Main.mp3";
	else if (id == "22") return "Mangton Ko Sultan Banaya 5.mp3";
	else if (id == "23") return "Mera Dil Tarap Raha Hay.mp3";
	else if (id == "24") return "Meray Sarkar Aagaay.mp3";
	else if (id == "25") return "Mere Rub Kahan Pe Nahin Hai Tu.mp3";
	else if (id == "26") return "Mugh Tayba Main Bula Lo Siddiq Ismail.mp3";
	else if (id == "27") return "Mujh Main Un Ki Sana Ka Salika Kahan.mp3";
	else if (id == "28") return "Mustafa Mujtaba Marhaba Marhaba by Um E Habiba.mp3";
	else if (id == "29") return "Nabiyon Nabiyon Nabiyon by Waheed Zafar.mp3";
	else if (id == "30") return "Nabiyon Nabiyon by Um E Habiba.mp3";
	else if (id == "31") return "Na Kahin Se Door Hain.mp3";
	else if (id == "32") return "Noor E Mujjassim Um E Habiba.mp3";
	else if (id == "33") return "Noori Mahfil Pe Chaddar Tani Noor Ki by Siddiq Ismail.mp3";
	else if (id == "34") return "Our Guide Is The Quran by Yousuf Islam.mp3";
	else if (id == "35") return "Qaseeda Burda Shareef by Zafar Qasmi.rm";
	else if (id == "36") return "Qaseeda Burda Shareef Mesut Kurtis Burdah.mp3";
	else if (id == "37") return "Qasida Burda Sharif.mp3";
	else if (id == "38") return "Rehmat Ka Hai Darwaza Khula.mp3";
	else if (id == "39") return "Salaam Ke Liye Hazir Ghulam Ho Jai by waheed zafar.mp3";
	else if (id == "40") return "Supplication Sami Yousuf 8.mp3";
	else if (id == "41") return "Tala Al Badru Alaina Arabic.mp3";
	else if (id == "42") return "The Cave Of Hira Sami Yousuf 3.mp3";
	else if (id == "44") return "Who Is The Loved One Sami Yousuf 2.mp3";
	else if (id == "45") return "Ya Nabi Ya Nabi Ya Nabi.mp3";
	else if (id == "46") return "Ya Rasoolallaha Aap Kay Dar Ki Siddiq Ismail .mp3";
	else if (id == "48") return "Yeh Kehti Thi Ghar Ghar Main Siddiq Ismail.mp3";
	else if (id == "49") return "Ye Naat Mustafa Ka.mp3";
	else if (id == "50") return "Zahe Muqaddar Huzoor E Haq Se by waheed zafar qasmi.mp3";
	else if (id == "51") return "Meri Jholi Ko Bhar Do Aye Khuda by alhaj khursheed.mp3";
	else if (id == "52") return "Abtar thee fiza by owais raza.mp3";
	else if (id == "53") return "Allahhu Allah as subhu by waheed zafar qasmi.mp3";
	else if (id == "54") return "Muhammad Ka Rauzah Qareeb Aa raha hay naat by junaid jamshaid.mp3";
	else if (id == "55") return "shukar hay Tera Khudaya may to is qabil na tha by abubakr.mp3";
	else if (id == "56") return "Jab Husan Tha Unka Jalwa Numa Anwaar Ka Aalam Kia Hoga.mp3";
	else if (id == "57") return "Elahi Teri chawkhat pay by junaid jamshaid.mp3";
	else if (id == "58") return "Aye mot theher jaa Main Madinay jaanlanwa punjabi naat by owais raza.mp3";
	else return "";
}


function GetQD(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+1);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,42);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=QD="+text;
}

function GetQVA(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+1);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,41);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=QVA="+text;
}

function GetQVU(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+1);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,41);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=QVU="+text;
}

function GetQVE(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+1);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,41);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=QVE="+text;
}

function GetQVAUE(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+1);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,39);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=QVAUE="+text;
}

function GetS(obj)
{
	var text = obj.innerHTML;
	text = text.replace('&nbsp;','');
	text = text.replace('&nbsp;','');
	text = text.substring(text.indexOf(')')+3);
	while (text.indexOf('.') > -1)
		text = text.replace('.',' ');
	while (text.indexOf('  ') > -1)
		text = text.replace('  ',' ');

	text = text.substring(0,40);
	
	this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=song="+text;
	
	//alert("Server space unavailable. Later!");
}

function GetLink(obj)
{
	this.frmGetLink.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=extlink="+obj;
}


function validateEmailAndDoGetHN(txtemail, txtcomments)
{
		if (isValidEmail(txtemail.value))
		{
			var textForGetFrame = txtcomments.value.substring(0,35);
			while (textForGetFrame.indexOf('.') > -1)
				textForGetFrame = textForGetFrame.replace('.',' ');
			while (textForGetFrame.indexOf('  ') > -1)
				textForGetFrame = textForGetFrame.replace('  ',' ')
				
			this.getFrame.location.href="http://faisalmb.com/web/general/Visitor.aspx?hvisit=hamdonaat/="+textForGetFrame;
			
			pauseMe(4000);
			return true;
		}
		else
		{
			alert('Enter valid e-mail address.');
			txtemail.focus();
			return false;
		}
}


function pauseMe(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function isValidEmail(email, required) 
{
	isValid = false;
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        isValid = true;
    }
    
    if (email.length==0) {
   	if (required) 
        { 
            return false;
        }
        else
        {
            return true;
        }
        isValid = true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        isValid = false;
    }
    
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        isValid = false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        isValid = false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        isValid = false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
				isValid = false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
				isValid = false;
    }
    else {
    	isValid = true;
    }

    if (isValid)
    {
    	return true;
    }
    else
    {
    	return false;
    }
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}


function validateEmail(txtemail, required)
{
	if (isValidEmail(txtemail.value, required))
	{
		return true;
	}
	else
	{
		alert('Enter valid e-mail address.');
		txtemail.focus();
		return false;
	}
}

function clearThisGuest(object)
{
	if (object.value.indexOf('optional') > 0)
	{
		if (object.name == 'txturl')
		{
			object.value = 'http://';
		}
		else
		{
			object.value = '';
		}
	}
}

function aguest()
{
	var mfromsite1 = window.location.href;
	document.fguest.hfromsite1.value = mfromsite1;
}

function setLaughBabySound()
{
    sound.src='http://faisalmb.com/addons/babylauf.wav';
}

ax=0;
function writeTable() {
	ax=Math.round(Math.random()*26);
	alphaArray=new Array("a", "n", "b", "d", "f", "h", "{", "i", "l", "v", "x", "z", "I", "J", "M", "N", "o", "O", "R", "S", "T", "U", "m", "6", "^", "u", "_", "[", "]")
	table="<table border=0 cellspacing=1 cellpadding=3 width='100%'><tr>"
	j=1;
	for ( i = 99 ; i >= 0 ; i-- ) {
		a=Math.round(Math.random()*26);
		if ( i%9 == 0 &&  i < 89 )
			a=ax;
		table+="<td class='numtd'>"+i+"</td><td class='symtd'>"+alphaArray[a]+"</td>"
		if ( j%10 == 0 )
			table+="</tr><tr>"
		j++
	}
	table+="</table>"
	sym.innerHTML=table
	sh.innerHTML=""
}
function showAnswer() {
	sh.innerHTML=alphaArray[ax]
	sym.innerHTML="<h1><a href='javascript:writeTable()'>Again</a></h1>"
}


function ExpImg(obj)
{
	obj.width=obj.width+4;
	obj.height=obj.height+4;
}

function DescImg(obj)
{
	obj.width=obj.width-4;
	obj.height=obj.height-4;
}


   function ClearLabel(lblClientId)
   {
        var lbl = document.getElementById(lblClientId);
        lbl.innerHTML = "";
        return false;
   }

    nn=(document.layers)?true:false;
    ie=(document.all)?true:false;

    document.onkeyup=CheckFieldsForHTMLTags;
    if(nn) document.captureEvents(Event.KEYUP);
    
    function CheckFieldsForHTMLTags()
    {
        if (String(window.location).indexOf("RoleFeatureActionAssignment.aspx") > 0)
        {
            //do nothing
        }
        else
        {
            var frm = document.forms[0];
            var isValidated = true;
            var e;
		    for (var i=0; i<frm.length; i++)
		    {
			    e = frm.elements[i];
			    if (e.type == 'text' || e.type == 'textarea') 
			    {
			        if (e.value.indexOf('<') != -1 || e.value.indexOf('>') != -1)
			        {
			            e.value = replaceAllMy(e.value,"<","");
			            e.value = replaceAllMy(e.value,">","");
			            isValidated = false;
			        }
			    }
		    }
		}
    }

    function replaceAllMy(checkMe,toberep,repwith)
    {
        var temp = checkMe;
        var i = temp.indexOf(toberep);
        while(i > -1)
        {
        temp = temp.replace(toberep, repwith);
        i = temp.indexOf(toberep, i + repwith.length);
        }
        return temp;
    }
            

