// JavaScript Document

/* ---- code added by salim on 09-10-2009 (ajax functionality user in footer section) -------*/
function display_data(id) { 
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null) {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="footer_function.php";
    url=url+"?employ_id="+id;
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
            document.getElementById('employ_data').innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}
var conValue;
function display_data2(conValue) { 

    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null) {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="footer_function.php";
    url=url+"?flag="+conValue;
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
            document.getElementById('job_data').innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);

}

function display_News(conValue) { 
	
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null) {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="footer_function.php";
    url=url+"?flag="+conValue;
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
            document.getElementById('news_data').innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}


// function for sending contact email from the footer section //
function sendEmail() { 
	
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null) {
        alert ("Your browser does not support AJAX!");
        return;
    } 
	var optionSelected;
	var optionSelectedText;
	var checkForm
	var firstname;
	var lastname;
	var email;
	var phone;
	var message;
	var loginflag;
	loginflag = '';
	
	optionSelected = document.formFooter.selectoption.value;
	//optionSelectedText = document.formFooter.selectoption.selected;
	
	checkForm = document.formFooter.chk_form.value;
	firstname = document.formFooter.firstName.value;
	lastname = document.formFooter.lastName.value;
	email = document.formFooter.email.value;
	phone = document.formFooter.phone.value;
	message = document.formFooter.comments.value
	
    var url="contact-email-function.php";
    url=url+"?selectoption="+optionSelected + "&amp;chk_form="+checkForm + "&amp;firstName"+firstname+"&amp;lastname="+lastname +"&amp;phone="+phone + "&amp;email="+email+"&amp;comments="+message+"&amp;loginflag="+loginflag;
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {	
         	document.getElementById('contactErrorMessage').innerHTML = "<font color='#ffffff'>Thank you, Your message has been sent successfully.</font>";
			
		document.formFooter.chk_form.value="";
		document.formFooter.firstName.value="First Name ...";
		document.formFooter.lastName.value="Last Name ...";
		document.formFooter.email.value="Email ...";
		document.formFooter.phone.value="Phone ...";
		document.formFooter.comments.value="Message ...";
		document.formFooter.selectoption.selectedIndex  =0;
		    //document.getElementById('news_data').innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

//----------------------------------------------------------------------------


function GetXmlHttpObject() {
    var xmlhttp=null;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlhttp=new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlhttp;
}

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars[hash[0]];
}

var page;
function openBox(page) {
	if(page=='inconsisExplained'){
	GB_showCenter('Inconsistencies Explained','http://www.prioritiesnow.com/help/inconsitencies_expl.html', 400,650);
	} else if(page=='howto'){
	GB_showCenter('Be Brown for a day.','http://www.prioritiesnow.com/help/hn_howto.html', 425,650);
	}
}

var flHeight;
var flWidth;
var sliderID;
var sliderID1;
var sliderID2;
function showFlash(flHeight, sliderID){
	//document.getElementById('flashcontent1').style.height = 900+"px";
	flHeight = flHeight+'px';
	//alert(sliderID);
	document.getElementById(sliderID).style.height = flHeight;
	document.getElementById(sliderID).style.width = '334px';
	sliderID1 = sliderID+'1';
	document.getElementById(sliderID1).style.height = flHeight;
	//alert(flHeight+"-"+sliderID);
	sliderID2 = sliderID+'2';
	document.getElementById(sliderID2).style.height = flHeight;

}

function showImage(flWidth, sliderID2){
	//alert(flWidth);
	flWidth = flWidth+'px';
	document.getElementById(sliderID2).style.width = flWidth;
	//alert(flWidth+" ! "+sliderID1);
}

function gotoAnchor(sliderID1){
	window.location.hash=sliderID1+'a';
	//alert(sliderID1);
}
// ----- added by salim 

function checkOption(str_val)
{
      document.getElementById("showOption").style.display = "none";
	  selected_text=str_val;
	   //var selected_text = document.myForm.selectoption.options[document.myForm.selectoption.options.selectedIndex].value;
	   //below condition by jyoti
	  //alert (selected_text);
	   if(selected_text==0)
		{
			//document.getElementById("showOption").innerHTML = "";
		    //document.formFooter.comments.value ="";
			//document.getElementById("addnews").style.display="none";
		} 

	   
	   if(selected_text==1)
	   {
		   
		   document.getElementById("showOption").style.display = "block";
			<?
				
				$msg=urlencode(nl2br($msg));
			?>
			//window.location="thankyou.php?backpage=contactus.php";
			
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
		} 
		else if(selected_text==2)
		{
		//alert('option2');
		
		//document.getElementById("contactMessage").style.display= "block";
		
		
		 document.getElementById("showOption").style.display = "none";
		
		document.getElementById("contactMessage").style.display = "block";
		document.getElementById("contactMessage").innerHTML = "<b>Have you read our <a href='faq.php' class='footerTextContact'>FAQ section</a> and the notes on the <a href='export.php' class='footerTextBody' >Export page</a>?. If you still require assistance please let us know in the box below.</b><br><div  class=\"footerHeadingB\" style='position:absolute; float:right; right:10; font-size:11px;'><a href='javascript:void(0);' onclick='document.getElementById(\"contactMessage\").style.display=\"none\";'><u>Close<\/u><\/a><\/div>";
			

			//document.getElementById("showOption").innerHTML = "<p align='justify' style='margin-left:25px'>Have you read our <a href='faq.php' style='color:000099'>FAQ section</a> and the notes on the <a href='export.php' style='color:000099'>Export page</a>?. If you still require assistance please let us know in the box below.</p>";
		    //document.myForm.comments.value ="";//jyoti 190908
			//document.getElementById("addnews").style.display="none";
		} else if(selected_text==3)
		{
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
			
	        //document.myForm.comments.value ="";//jyoti 190908
			//document.getElementById("addnews").style.display="none";
			
			

			
		} 
		else if(selected_text==4)
		{
		 //  document.getElementById("showOption").innerHTML = "<p align='justify' style='margin-left:25px'>Any Housing Association or Local Authority employee can gain <a href=accessurl.php>Access to our system</a> using their work email address via the Access page. From Access they can edit any of the data we hold on their organization and register for Free to use the Housingnet data. <br><br>We really appreciate being informed of any errors or changes in the data we hold so please let us know in the form below. The name and contact fields are not required so do not have to be completed if you dont want to.</p>";
		   //document.myForm.comments.value ="";//jyoti 190908
		   //document.getElementById("addnews").style.display="none";
		   
			document.getElementById("contactMessage").style.display = "block";
			document.getElementById("contactMessage").innerHTML = "Any Housing Association or Local Authority employee can gain <a href=\"accessurl.php\">Access to our system<\/a> using their work email address via the Access page. From Access they can edit any of the data we hold on their organization and register for Free to use the Housingnet data. <br/><br/>We really appreciate being informed of any errors or changes in the data we hold so please let us know in the form below. The name and contact fields are not required so do not have to be completed if you dont want to.<br/><div  class=\"footerHeadingB\" style='position:absolute; float:right; right:10; font-size:11px;'><a href='javascript:void(0);' onclick='document.getElementById(\"contactMessage\").style.display=\"none\";'><u>Close<\/u><\/a><\/div>";
			
			document.getElementById("showOption").style.display = "none";
		   

		} 
		else if(selected_text==5)
		{
			//document.getElementById("showOption").innerHTML = "";
			//document.myForm.comments.value ="";//jyoti 190908
			//document.getElementById("addnews").style.display="none";
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
		} 
		else if(selected_text==6)
		{
			location.href ="forgot_pass.php";
			//document.getElementById("addnews").style.display="none";
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
		}
		else if(selected_text==7)
		{
			///document.getElementById("addnews").style.display="none";
			//document.myForm.comments.value="";
			//document.getElementById("showOption").innerHTML = "";
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
		}
		else if(selected_text==8)
		{
		     //document.getElementById("addnews").style.display="none";
			 //document.myForm.comments.value="";
			 //document.getElementById("showOption").innerHTML = "";
			 
			 document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
		}
		else if(selected_text==9)
		{
			/*document.myForm.comments.value="Add your News here";
			document.getElementById("showOption").innerHTML = "";
			document.getElementById("addnews").style.display="block";
			
			*/
			document.getElementById("contactMessage").innerHTML ="";
			document.getElementById("contactMessage").style.display = "none";
			document.getElementById("showOption").style.display = "none";
			window.location="generalnews.php";
			
		}
  }
