// JavaScript Document

function BrWindow(xfID) { //v2.0
  //window.open(theURL,winName,features);
  var fID=xfID
  var theURL="getNewsID.asp?featureID="+xfID;
  var features="width=570,height=350,scrollbars,resizable,top=0,right=0";
  var winName="windname2";
  window.open(theURL,winName,features);
  
}
var loadstatustext="<img src='images/loading.gif' />"
var xmlHttp = false;

function get(theForm)
{var fobj=theForm;
 var str = "";  
 var ft = "";  
 var fv = ""; 
 var fn = "";  
 var els = "";
 var str
for( var i = 0;i < theForm.elements.length; i++ ) 
{    
els = fobj.elements[i];    
ft = els.title;   
fv = els.value;    
fn = els.name;   
switch(els.type) 
	{    
	case "text":   
	case "hidden":    
	case "password":    
	case "textarea":    // is it a required field?    
	//	if((ft) == "required" && (fv).length < 1) 
if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) 

		{      
		alert (fn+' is a required field, please complete.');      
		//els.focus();       
		return false;    
		}     
		//str += fn + "=" + (fv) + "&";    
		str += fn + "=" + encodeURI(fv) + "&";    

		break;        
		case "checkbox":     
		case "radio":      
		//if(els.checked) str += fn + "=" + (fv) + "&";     
		if(els.checked) str += fn + "=" + encodeURI(fv) + "&";     
		break;           
		case "select-one":       
		str += fn + "=" +       
		els.options[els.selectedIndex].value + "&";     
		break;     
		} // switch    
		} // for    
		str = str.substr(0,(str.length - 1));   
	//alert(str);
		makeRequest_new(str);
		}   

///////
function makeRequest_new(str)
{ 
var url="to_do/add_new.asp";
//url=url+"?"+str;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
/*
xmlHttp.onreadystatechange=showmakeRequest;
//alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
*/
	  xmlHttp.onreadystatechange = showmakeRequest;
      xmlHttp.open('POST', url, true);
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", str.length);
      xmlHttp.setRequestHeader("Connection", "close");
      xmlHttp.send(str);

}

function showmakeRequest() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("txtMsg1").innerHTML = loadstatustext;
 document.getElementById("subMSG").innerHTML= loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("txtMsg1").innerHTML = "Just a moment please...";
 document.getElementById("subMSG").innerHTML="Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("txtMsg1").innerHTML = "Just a moment please...";
 document.getElementById("subMSG").innerHTML="Just a moment please...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("txtMsg1").innerHTML = "Done";
 document.getElementById("subMSG").innerHTML=  "Done";
}


if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("txtMsg").innerHTML=xmlHttp.responseText;
document.getElementById("txtMsg2").innerHTML="";
//document.getElementById("subMSG").innerHTML="Good";



}
}
///////
// get_makePsrcov

function get_makePsrcov(formEmail)
{var fobj=formEmail;
 var str = "";  
 var ft = "";  
 var fv = ""; 
 var fn = "";  
 var els = "";
 var str
for( var i = 0;i < fobj.elements.length; i++ ) 
{    
els = fobj.elements[i];    
ft = els.title;   
fv = els.value;    
fn = els.name;   
switch(els.type) 
	{    
	case "text":   
	case "hidden":    
	case "password":    
	case "textarea":    // is it a required field?    
	if((ft) == "required" && (fv).length < 1) 
//	if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) 

		{      
		alert (fn+' is a required field, please complete.');      
		//els.focus();       
		return false;    
		}     
		str += fn + "=" + (fv) + "&";    
		//str += fn + "=" + encodeURI(fv) + "&";    

		break;        
		case "checkbox":     
		case "radio":      
		if(els.checked) str += fn + "=" + (fv) + "&";     
		//if(els.checked) str += fn + "=" + encodeURI(fv) + "&";     
		break;           
		case "select-one":       
		str += fn + "=" +       
		els.options[els.selectedIndex].value + "&";     
		break;     
		} // switch    
		} // for    
		str = str.substr(0,(str.length - 1));   
		makePsrcov(str);
		}  

///////

function makePsrcov(str)
{ 
var url="to_do/psrcov_mm.asp";
url=url+"?"+str;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=showPsrcovRequest;
alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showPsrcovRequest() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("subMSG").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
  document.getElementById("subMSG").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("subMSG").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 3)
{
  document.getElementById("subMSG").innerHTML = "Done";

}
	if (xmlHttp.readyState==4)
	//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("txtMsgEmail").innerHTML=xmlHttp.responseText;
document.getElementById("txtMsg").innerHTML="";
document.getElementById("MyInfo").innerHTML="";
document.getElementById("MyInfo1").innerHTML="";
document.getElementById("MyInfo2").innerHTML="";
document.getElementById("MyInfo3").innerHTML="";
document.getElementById("nav1").innerHTML="";
//mostafa
/////
////
}
}
///////
///Email_is_good

function EmailIsIn(str)
{ 
var url="regEmail.asp";
url=url+"?email="+str;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=showregEmail;
//alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showregEmail() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("txtMsg1").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("txtMsg1").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("txtMsg1").innerHTML = " Loading...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("txtMsg1").innerHTML = loadstatustext; //"Response Ready...";
}


if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("msgerr").innerHTML=xmlHttp.responseText;
//document.getElementById("txtMsg2").innerHTML="loveyou";

}
}
///////2nd form
function get_showMyLogin(formlogin)
{
	var fobj=formlogin;
 var str = "";  
 var ft = "";  
 var fv = ""; 
 var fn = "";  
 var els = "";
 var str
for( var i = 0;i < fobj.elements.length; i++ ) 
{    
els = fobj.elements[i];    
ft = els.title;   
fv = els.value;    
fn = els.name;   
switch(els.type) 
	{    
	case "text":   
	case "hidden":    
	case "password":    
	case "textarea":    // is it a required field?    
	if((ft) == "required" && (fv).length < 1) 
//	if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) 

		{      
		alert (fn+' is a required field, please complete.');      
		//els.focus();       
		return false;    
		}     
		str += fn + "=" + (fv) + "&";    
		//str += fn + "=" + encodeURI(fv) + "&";    

		break;        
		case "checkbox":     
		case "radio":      
		if(els.checked) str += fn + "=" + (fv) + "&";     
		//if(els.checked) str += fn + "=" + encodeURI(fv) + "&";     
		break;           
		case "select-one":       
		str += fn + "=" +       
		els.options[els.selectedIndex].value + "&";     
		break;     
		} // switch    
		} // for    
		str = str.substr(0,(str.length - 1)); 
		alert(str)
		showMyInfo(str);
		}  


///////
function showMyInfo(str)
{ 
var url="login.asp";
url=url+"?"+str;

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=showmyformRequest;
alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showmyformRequest() 
{
 document.getElementById("nav").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("nav").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("nav").innerHTML = " Loading...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("nav").innerHTML = loadstatustext; //"Response Ready...";
}

 

if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("MyInfo1").innerHTML=xmlHttp.responseText;
document.getElementById("nav1").innerHTML="";
document.getElementById("nav").innerHTML="";

}
//}



///////theForm 
function get_theForm(the_UPDATE_Form)
{var fobj=the_UPDATE_Form;
 var str = "";  
 var ft = "";  
 var fv = ""; 
 var fn = "";  
 var els = "";
 var str
for( var i = 0;i < fobj.elements.length; i++ ) 
{    
els = fobj.elements[i];    
ft = els.title;   
fv = els.value;    
fn = els.name;   
switch(els.type) 
	{    
	case "text":   
	case "hidden":    
	case "password":    
	case "textarea":    // is it a required field?    
	if((ft) == "required" && (fv).length < 1) 
//	if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) 

		{      
		alert (fn+' is a required field, please complete.');      
		//els.focus();       
		return false;    
		}     
		str += fn + "=" + (fv) + "&";    
		//str += fn + "=" + encodeURI(fv) + "&";    

		break;        
		case "checkbox":     
		case "radio":      
		if(els.checked) str += fn + "=" + (fv) + "&";     
		//if(els.checked) str += fn + "=" + encodeURI(fv) + "&";     
		break;           
		case "select-one":       
		str += fn + "=" +       
		els.options[els.selectedIndex].value + "&";     
		break;     
		} // switch    
		} // for    
		str = str.substr(0,(str.length - 1));   
		showtheForm(str);
		}  


///////
function showtheForm(str)
{ 
var url="to_do/update_myform.asp";
//url=url+"?"+str;

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
/*
xmlHttp.onreadystatechange=showtheFormRequest;
//alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
*/

	  xmlHttp.onreadystatechange = showtheFormRequest;
      xmlHttp.open('POST', url, true);
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", str.length);
      xmlHttp.setRequestHeader("Connection", "close");
      xmlHttp.send(str);

}

function showtheFormRequest() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("txtMyInfo").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("txtMyInfo").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("txtMyInfo").innerHTML = " Loading...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("txtMyInfo").innerHTML = loadstatustext ; //"Response Ready...";
}


if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
//document.getElementById("MyInfo1").innerHTML="";
document.getElementById("MyInfo1").innerHTML=xmlHttp.responseText;
//document.getElementById("UpdateMsg").innerHTML=""

}
}

////pw///

///////theForm 
function do_theForm_pw(the_update_mypw)
{var fobj=the_update_mypw;
 var str = "";  
 var ft = "";  
 var fv = ""; 
 var fn = "";  
 var els = "";
 var str
for( var i = 0;i < fobj.elements.length; i++ ) 
{    
els = fobj.elements[i];    
ft = els.title;   
fv = els.value;    
fn = els.name;   
switch(els.type) 
	{    
	case "text":   
	case "hidden":    
	case "password":    
	case "textarea":    // is it a required field?    
	if((ft) == "required" && (fv).length < 1) 
//	if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) 

		{      
		alert (fn+' is a required field, please complete.');      
		//els.focus();       
		return false;    
		}     
		str += fn + "=" + (fv) + "&";    
		//str += fn + "=" + encodeURI(fv) + "&";    

		break;        
		case "checkbox":     
		case "radio":      
		if(els.checked) str += fn + "=" + (fv) + "&";     
		//if(els.checked) str += fn + "=" + encodeURI(fv) + "&";     
		break;           
		case "select-one":       
		str += fn + "=" +       
		els.options[els.selectedIndex].value + "&";     
		break;     
		} // switch    
		} // for    
		str = str.substr(0,(str.length - 1));   
		show_mypw(str);
		}  


///////
function show_mypw(str)
{ 
var url="to_do/update_mypw.asp";
url=url+"?"+str;

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=showtheFormPw;
//alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showtheFormPw() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("txtMyInfo").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("txtMyInfo").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("txtMyInfo").innerHTML = " Loading...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("txtMyInfo").innerHTML = loadstatustext;//"Response Ready...";
}


if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("MyPwMsg").innerHTML="";
document.getElementById("MyInfo2").innerHTML=xmlHttp.responseText;

//document.getElementById("MyInfo1").innerHTML="";

}
}
///////theForm 

///////
function do_theForm_renewal(str)
{ 
var url="to_do/renewal.asp";
url=url+"?MM_Id="+str;

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=showtheForm_renewal;
//alert (url)
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showtheForm_renewal() 
{ 
if(xmlHttp.readyState == 0)
{
 document.getElementById("txt_MyInfo3").innerHTML = loadstatustext;
}
if(xmlHttp.readyState == 1)
{
 document.getElementById("txt_MyInfo3").innerHTML = "Just a moment please...";
}
if(xmlHttp.readyState == 2)
{
 document.getElementById("txt_MyInfo3").innerHTML = " Loading...";
}
if(xmlHttp.readyState == 3)
{
 document.getElementById("txt_MyInfo3").innerHTML = loadstatustext;
}


if (xmlHttp.readyState==4)
//if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
{ 
document.getElementById("MyInfo3").innerHTML=xmlHttp.responseText;

//document.getElementById("MyInfo1").innerHTML="";

}
}


//end pw //
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;
}