/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="index.php?page=qarees"><font color="#FFFFFF">Qurân</font></a>'
menu1[1]='<a href="index.php?page=adhan"><font color="#FFFFFF">Adhân (Gebetsruf)</font></a>'
menu1[2]='<a href="index.php?page=dua"><font color="#FFFFFF">Du\'â (Bittgebete)</font></a>'
menu1[3]='<a href="index.php?page=multimedia"><font color="#FFFFFF">Lesungen</font></a>'
//menu1[3]='<a href="index.php?page=multimedia&part=88"><font color="#FFFFFF">Animationen</font></a>'

var menuwidth='165px' //default menu width
var menubgcolor='#7C7674'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


function bb()
{
	if(document.getElementById('contactus').style.display == 'none')
	{
		var arrayPageScroll = getPageScroll();
		var arrayPageSize = getPageSize();

		leftVal = (((arrayPageSize[0] - 400) / 2) + 'px');
		topVal = (arrayPageScroll[1] + ((arrayPageSize[3] - 400) / 2) + 'px');

		document.getElementById('contactus').style.left = leftVal;
		document.getElementById('contactus').style.top = topVal;

		document.getElementById('contactus').style.display = '';
		var ht = document.getElementsByTagName("body")[0];
		ht.style.filter = "FILTER: progid:DXImageTransform.Microsoft.Alpha( style=0,opacity=25);";
		document.getElementById('name').focus();
	}
	else
	{
		document.getElementById('contactus').style.display = 'none';
		var ht = document.getElementsByTagName("body")[0];
		ht.style.filter = "";
	}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}


function ajaxopen(div, url,parameters)
  {

  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
		alert(YES);
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
	
	xmlHttp.onreadystatechange=function()
	  {
	  if(xmlHttp.readyState==4)
		{
		//	alert(xmlHttp.responseText);
			document.getElementById(div).innerHTML = xmlHttp.responseText;
		//	alert(document.getElementById(div).innerHTML);
		//	document.getElementById('loading').style.display = 'none';
		}
		else
		{ 
		//	var arrayPageScroll = getPageScroll();
		//	var arrayPageSize = getPageSize();
			
		//	document.getElementById('loading').style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 189) / 2) + 'px');
		//	document.getElementById('loading').style.left = (((arrayPageSize[0] - 20 - 295) / 2) + 'px');

//			document.getElementById('loading').style.display = '';
		}
	  }

	xmlHttp.open("POST",url,true);
	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", parameters.length);
    xmlHttp.setRequestHeader("Connection", "close");

	xmlHttp.send(parameters);
  }


function sendEmail(name,email,body)
{
	if(name!='' && email!='' && body!='')
	{
		document.getElementById('contactus').innerHTML = '<p align="center"><br><br><img alt="" src="images/loading.gif" width="48" height="48" /><br>Bitte warten...';
		ajaxopen('contactus', 'contactusaction.php','email=' + encodeURI(email) + '&name=' + encodeURI(name) + '&body=' + encodeURI(body));
	}
	else
	{
		alert('Bitte alle Felder ausfüllen!');
	}
}

function regEmail()
{
	var mail = document.getElementById('word').value;

	if(mail!='')
	{
		var d = document.getElementById('alerts');
		var s = document.createElement('SCRIPT');
		s.type = 'text/javascript';
		s.src = 'sp_newsl_reg.php?word=' + encodeURI(mail);
		d.appendChild(s);
	}
	else
	{
		alert('Bitte alle Felder ausfüllen!');
	}
}


// JavaScript Document
//top tabs
var Home_over=new Image();
   Home_over.src="images/IslamWeb_btn_Home-over.gif";
   
var Contact_over=new Image();
    Contact_over.src="images/IslamWeb_btn_Contact-over.png";
	
var About_over=new Image();
    About_over.src="images/IslamWeb_btn_About-over.png";
	
var Register_over=new Image();
    Register_over.src="images/IslamWeb_btn_Register-over.png";
    
var Fatwa_over=new Image();
    Fatwa_over.src="images/IslamWeb_btn_Fatwa-over.png";     


// roll over image

var Muslims_over=new Image();
    Muslims_over.src="images/IslamWeb_btn_Muslims-over.png";
   
var Library_over=new Image();
    Library_over.src="images/IslamWeb_btn_Library-over.png";
	
var Fatwas_over=new Image();
    Fatwas_over.src="images/IslamWeb_btn_Fatwas-over.png";
	
var Multimedia_over=new Image();
    Multimedia_over.src="images/IslamWeb_btn_Multimedia-over.png";
   
var Article_over=new Image();
    Article_over.src="images/IslamWeb_btn_Article-over.gif";


//function for image over
function mouse_over(imageName){
		//document.images[imageName].src="images/IslamWeb_Button/"+ imageName +"_sel.gif";
		document.images[imageName].src=eval(imageName +"_over.src");
		}
//function for image out
function mouse_out(imageName){
		document.images[imageName].src="images/IslamWeb_btn_"+ imageName +".gif ";
		}
		
//evalidation

// New script added for Email validation
function chkdata()
{
strpass='word';
//alert(strpass);
	
//alert(document.getElementById(strpass).value);
if(document.getElementById(strpass).value=="")
{

alert("Formato incorrecto del email");
document.getElementById(strpass).focus();
return false;
}

else if(chkemail(strpass)==false)
{
alert("Formato incorrecto del email");
document.getElementById(strpass).focus();
return false;
}

else
{
//document.getElementById(strpass).submit();

//alert(document.getElementById(strpass).word.value);

window.open ("http://www.islamweb.net/nlreg/newsl_reg.php?lang=G&word="+document.getElementById(strpass).value, "mywindow","width=520,height=230");
}

}

function chkemail(strpass)
{
var at="@"
var dot="."
var str=document.getElementById(strpass).value;
//alert(str);
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)

//alert(lat)

if(lat==-1 || ldot==0 || ldot==lstr) return false

if(dot==-1 || lat==0 || lat==lstr) return false

		// To check more than one @
if(str.indexOf(at,(lat+1))!=-1) return false

//alert(str.substring(lat+1,lat+2)) //Here cheking if '.' exist just before .@ and just after @.
if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false

//alert(str.indexOf(dot,(lat+2))); //To check existance of atleast one '.' after '@' 
if(str.indexOf(dot,(lat+2))==-1) return false

if(str.indexOf(" ")!=-1) return false

dotl=str.substring(ldot+1,ldot+3);
dlen=dotl.length
if(dlen<2) return false

if(str.substring(lstr-1,lstr)==dot) return false

}
// New script added for Email validation







             //For News Letter Eamil
function clearvalue(strpass)
{
	
if(document.getElementById(strpass).word.value=="Your Email Address")
{
	//alert(document.getElementById(word).value)
document.getElementById(strpass).word.value="";
}
}

function addvalue(strpass)
{
if(document.getElementById(strpass).word.value=="")
document.getElementById(strpass).word.value="Your Email Address";
}
