function getPage(page){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object...
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/mpcs/precomment1.php?pageid='; //This is the path to the file we just finished making *
    xmlhttp.open('GET', file + page, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
     //   alert(file + page);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
        //alert(content);
                      document.getElementById('content').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}
function getPageComments(page){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object...
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/mpcs/text.php?pageid='; //This is the path to the file we just finished making *
    xmlhttp.open('GET', file + page, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var nopages = xmlhttp.responseText; //The content data which has been retrieved ***
                if( nopages ){ //Make sure there is something in the content variable
                      document.getElementById('nopages').innerHTML = nopages; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
function saveComments(page){
  if (document.getElementById('name').value=="")
  {
  	alert("Please Enter a Name!");
  	document.getElementById('name').focus();
  	return true;
  }
  if (document.getElementById('email').value=="")
  {
  	alert("Please Enter an Email Address!");
  	document.getElementById('email').focus();
  	return true;
  }
  else
    	if (echeck(document.getElementById('email').value)==false)
        {
		document.getElementById('email').value="";
        document.getElementById('email').focus();
        return true;
	}

  if (document.getElementById('text_comment').value=="")
  {
  	alert("Please Enter a Comment!");
  	document.getElementById('text_comment').focus();
  	return true;
  }
  document.getElementById('Submit').value="Please Wait.";	
  
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object...
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/mpcs/test.php?pageid='; //This is the path to the file we just finished making *
  var data =  '&name=' + encodeURIComponent(document.getElementById('name').value)+'&email=' + encodeURIComponent(document.getElementById('email').value)+'&comment=' + encodeURIComponent(document.getElementById('text_comment').value);
 //alert(file+ page+data);
    xmlhttp.open('GET', file + page+data, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
 // alert(xmlhttp.readyState);
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
 //  alert(content);
               if( content ){ //Make sure there is something in the content variable
 //  alert(content);
//  document.getElementById('Submit').set("label", "<b>Thank You</b>");	
 // document.getElementById('Submit').value="<b>Thank You....</b>";	
                      document.getElementById('content').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}
function processIt(type,page){
 //alert("processIt type:"+ type+"page:"+ page);
 if (type==1)
 {
 if (document.getElementById('user').value=="")
  {
  	alert("Please Enter a Username!");
  	document.getElementById('user').focus();
  	return true;
  }
  if (document.getElementById('pass').value=="")
  {
  	alert("Please Enter a Password!");
  	document.getElementById('pass').focus();
  	return true;
  }
  document.getElementById('login').value="Please Wait.";	
}  
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object...
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
       if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/process1.php?'; //This is the path to the file we just finished making *
        var data='';
 //alert("type1:"+ type);

if ((type==1) &&  (document.getElementById('sublogin')!=null))
   data =  'user=' + encodeURIComponent(document.getElementById('user').value)+
   '&pass=' + encodeURIComponent(document.getElementById('pass').value)+
   '&remember=' + encodeURIComponent(document.getElementById('remember').value)+
   '&pageid=' + encodeURIComponent(page)+
   '&sublogin=' + encodeURIComponent(document.getElementById('sublogin').value);
 // alert("type2:"+ type);

 if ((type==3) &&  (document.getElementById('subjoin')!=null))
   data =  'user=' + encodeURIComponent(document.getElementById('user').value)+
   '&pass=' + encodeURIComponent(document.getElementById('pass').value)+
   '&email=' + encodeURIComponent(document.getElementById('email').value)+
   '&fname=' + encodeURIComponent(document.getElementById('fname').value)+
   '&lname=' + encodeURIComponent(document.getElementById('lname').value)+
   '&pageid=' + encodeURIComponent(page)+
   '&subjoin=' + encodeURIComponent(document.getElementById('subjoin').value);
 //alert("type3:"+ data);

if ((type==2) && (document.getElementById('subforgot')!=null))
   data =  'user=' + encodeURIComponent(document.getElementById('user').value)+
   '&pageid=' + encodeURIComponent(page)+
   '&subforgot=' + encodeURIComponent(document.getElementById('subforgot').value);
//  alert("type4:"+ type);
if ((type==4) &&  (document.getElementById('subedit')!=null))
   data =  'curpass=' + encodeURIComponent(document.getElementById('curpass').value)+
      '&user=' + encodeURIComponent(document.getElementById('user').value)+
  '&fname=' + encodeURIComponent(document.getElementById('fname').value)+
  '&lname=' + encodeURIComponent(document.getElementById('lname').value)+
  '&newpass=' + encodeURIComponent(document.getElementById('newpass').value)+
   '&email=' + encodeURIComponent(document.getElementById('email').value)+
   '&pageid=' + encodeURIComponent(page)+
   '&subedit=' + encodeURIComponent(document.getElementById('subedit').value);
   
if ((type==5) && (document.getElementById('submarine')!=null))
   data =  'user=' + encodeURIComponent(document.getElementById('user').value)+
     '&email=' + encodeURIComponent(document.getElementById('email').value)+
//'&subscribe=' + ((Dom.get('subscribe').checked) ? 'yes' : 'no')+
'&subscribe=' + encodeURIComponent((document.getElementById('subscribe').checked)? 'yes' : 'no')+
   '&pageid=' + encodeURIComponent(page)+
   '&gotone=' + encodeURIComponent(document.getElementById('gotone').value)+
     '&submarine=' + encodeURIComponent(document.getElementById('submarine').value);

//alert(file+ data);
    xmlhttp.open('GET', file + data, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
 // alert(xmlhttp.readyState);
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
 //  alert(content);
               if( content ){ //Make sure there is something in the content variable
  // alert(content);
//  document.getElementById('Submit').set("label", "<b>Thank You</b>");	
 // document.getElementById('Submit').value="<b>Thank You....</b>";	
                      document.getElementById('login').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}
function callFunction(file){
// alert("callFunction "+file);
 
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object...
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
       if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
//        var file = '/forgotpass1.php'; //This is the path to the file we just finished making *
    xmlhttp.open('GET', file , true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
 // alert(xmlhttp.readyState);
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
 //  alert(content);
               if( content ){ //Make sure there is something in the content variable
   //alert(content);
//  document.getElementById('Submit').set("label", "<b>Thank You</b>");	
 // document.getElementById('Submit').value="<b>Thank You....</b>";	
                      document.getElementById('login').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function togglecomment() {
	var ele = document.getElementById("content");
	var text = document.getElementById("displayTextcomment");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "show";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "hide";
	}
} 
function togglerate() {
	var ele = document.getElementById("ratebit");
	var text = document.getElementById("displayTextrate");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "show";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "hide";
	}
} 
function togglelogin() {
	var ele = document.getElementById("login");
	var text = document.getElementById("displayTextlogin");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "show";
  	}
	else {
		ele.style.display = "block"; 
		text.innerHTML = "hide";
	}
} 
function doComments(page){
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=100%> <TR height=1><TD colSpan=2><HR SIZE=1></TD></TR></TABLE>');
	document.write ('<TABLE cellSpacing=0 cellPadding=6 width=100%>');
	document.write ('<TR> <TD class="bodyText" valign="top"><b>Comments System Version 2.1 </b>');
	document.write ('<b><div id=\"nopages\">');
getPageComments(page);
	document.write ('</div></b>');
document.write ('<a id="displayTextcomment" href="javascript:togglecomment();">hide</a><br/>');
	document.write ('<div id="content" style="display: block;width:450px;height:300px;overflow:auto;scrollbar-face-color: #cccccc;scrollbar-shadow-color: #333333;scrollbar-highlight-color: #ffffff;scrollbar-3dlight-color: #ffffff;scrollbar-darkshadow-color: #cccccc;scrollbar-track-color: #ffffff;scrollbar-arrow-color: #ffffff">');
getPage(page);
document.write ('</div></div>');

document.write ('<br/><b>Comments Notification</b><br/>');
	document.write ('Register your details and login below to be notified by email when new comments are posted.  <a id="displayTextlogin" href="javascript:togglelogin();">hide</a> <br/><br/>');
	document.write ('<div id="login" style="display: block;width:450px;height:200px;overflow:auto;scrollbar-face-color: #cccccc;scrollbar-shadow-color: #333333;scrollbar-highlight-color: #ffffff;scrollbar-3dlight-color: #ffffff;scrollbar-darkshadow-color: #cccccc;scrollbar-track-color: #ffffff;scrollbar-arrow-color: #ffffff">');

callFunction('/loginmain.php?pageid='+page);

document.write ('</div></div></TD></TR></TABLE>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=100%> <TR height=1><TD colSpan=2><HR SIZE=1></TD></TR></TABLE>');



return;
}
