function cleartext()
{
	obj=document.frm;
	obj.txtnewssearch.value="";
	return; 
}

function editpop(id,flag)
{
	mywindow = window.open ("editcomments.php?comm="+id+"&flag="+flag,"","scrollbars, width=502, height=460, status,toolbar=Off,menubar=Off");
}


function getSearch()
{
	obj=document.frmsearch;
	
	if(obj.txtcategory.value=="")
	{
		alert("Please enter search text");
		obj.txtcategory.focus();
		return false;
	}
	
	return true;
}

function countstringno()
{

	obj=document.myform;

	lenth=obj.txtcomments.value;
	len=lenth.length+1;
	obj.txtcount.value=1000-len;
	
	if((1000-len)<=0)
	{
		obj.txtcount.value =0;
		alert("You can not fedd more data, Data limit is 1000 characters" )
		obj.txtcomments.value = obj.txtcomments.value.substr(0,995);
		

		return;
	}
	

}

function validcomments()
{
	

	//obj=document.myform.txtcountry;
   // if(isEmpty(obj,"Country Name"))
        //return false;


	obj=document.myform.txtname;
	
    if(isEmpty(obj,"Name"))
        return false;

	
	obj=document.myform.txtpass;
    if(isEmpty(obj,"Password"))
        return false;

	
	/* obj=document.myform.txtemail
	 if(obj.value!="")
	 {
		 if (! isValidEmail(obj.value))
		 {
			alert("Invalid e-Mail-Id entered.");
			obj.focus();
			return false;
		 }
	 }*/

	  obj=document.myform.txtcomments
		if(isEmpty(obj,"Comments"))
		return false;
   
	return true;
   
}


function validforumcomments()
{
	

	
	obj=document.myform.txtname;
	
    if(isEmpty(obj,"Name"))
        return false;

	
	
	 obj=document.myform.txtemail
	 if(obj.value!="")
	 {
		 if (! isValidEmail(obj.value))
		 {
			alert("Invalid e-Mail-Id entered.");
			obj.focus();
			return false;
		 }
	 }

	  obj=document.myform.txtcomments
		if(isEmpty(obj,"Comments"))
		return false;
   
	return true;
   
}


function expond(id,sign)
{
	
	obj=document.myform;
	objA=document.getElementById("com1"+id);
	objB=document.getElementById("com100"+id);
	objplus=document.getElementById("img1"+id);
	objminus=document.getElementById("img100"+id);

	if(sign=='1')
	{
		objplus.style.display = "none";
		objminus.style.display = "block";
		objA.style.display="none";
		objB.style.display="block";
	}
	if(sign=='-1')
	{
		objplus.style.display = "block";
		objminus.style.display = "none";
		objA.style.display="block";
		objB.style.display="none";
	}

	


}

function expondforum(id,sign)
{
	
	obj=document.myform;
	objA=document.getElementById("com1"+id);
	objB=document.getElementById("com100"+id);
	//objplus=document.getElementById("img1"+id);
	//objminus=document.getElementById("img100"+id);

	if(sign=='1')
	{
		//objplus.style.display = "none";
		//objminus.style.display = "block";
		objA.style.display="none";
		objB.style.display="block";
	}
	if(sign=='-1')
	{
		//objplus.style.display = "block";
		//objminus.style.display = "none";
		objA.style.display="block";
		objB.style.display="none";
	}

	


}

function changesize(size)
{
}

function newspaging(check)
{
	obj=document.pagingform;
	
	if(check==1)
	{
		if(obj.nextpageno.value < parseInt(obj.totalpages.value)-1)
			obj.nextpageno.value=parseInt(obj.nextpageno.value)+1;
	}
	else
	{
		obj.nextpageno.value=parseInt(obj.nextpageno.value)-1

	}

	
	for(j=0; j<obj.totalpages.value; j++)
	{
		objB=document.getElementById("n"+j);
		objB.style.display="none";
	}

	if(check=="1")
		objA=document.getElementById("n"+obj.nextpageno.value);
	else
		objA=document.getElementById("n"+obj.backpageno.value);

		objA.style.display="block";

	objBack=document.getElementById("back");
	objNext=document.getElementById("next");
	if(obj.nextpageno.value>0)
	{
		objBack.style.display="block";
		obj.backpageno.value=parseInt(obj.nextpageno.value-1);

	}
	else
	{
		objBack.style.display="none";
	}
	

	if(obj.nextpageno.value==parseInt(obj.totalpages.value)-1)
	{
		objNext.style.display="none";
	}
	else
	{
		objNext.style.display="block";
	}
	
}
function onload()
{
	alert();
	objBack=document.getElementById("back");
	objNext=document.getElementById("next");
	objBack.style.display="none";
	objNext.style.display="none";
}
function  validCategoryBox()
{
	obj=document.search.txtcategory;
    if(isEmpty(obj,"Category"))
        return false;

	return true;
}



  function PopWin(myurl)
  {
	  myurl="print"
	var path;
	var title;
	var w;
	var mail="/print/mail.php";
	var pri ="print/printer.php";
	var comment="/print/comment.php";
	path=window.location;
	title=window.document.title;
	  switch (myurl)
	  {
		case ("mail"): docurl = mail + "?title=" + title + "&path=" + path;
		  w = open(docurl,"mail","resizable=no, width=430, height=445, scrollbars=yes, status=no, top=50, left=150, screenX=430, screenY=445");
		  break;
		case ("print"): docurl = pri + "?title=" + title + "&path=" + path;
		  w = open(docurl,"print", "location=no, scrollbars=yes, menubars=no, toolbars=no, resizable=yes, status=no, width=790, height=520, top=0, left=0, screenX=0, screenY=0");
		  break;
		case ("comment"): docurl = comment + "?title=" + title + "&path=" + path;
		  w = open(docurl,"comment","resizable=no, width=400, height=380, scrollbars=no, status=no, top=100, left=150, screenX=400, screenY=380");
	  }
	
	  if(w.opener==null) w.opener= self;
  }


function makemyhomepage()
 {
   mywindow = window.open ("html/makehomepage.html","","location=1,status=1,scrollbars=1, toolbar=Off, menubar=Off, width=700,height=440");
 // mywindow.moveTo(100,500);
 } 

function emailpopup(id)
{
	mywindow = window.open ("emailtofriend.php?NID="+id,"","scrollbars, width=502, height=460, status,toolbar=Off,menubar=Off");
							//window.open('url.htm', 'windowname', 'scrollbars,resizable,status,toolbar,menubar');

}
function validemailpopup()
{

	
	obj=document.forms[0].txtremail;
	
    if(!isValidEmail(obj.value))
	{
		alert("Invalid e-Mail-Id entered.");
		obj.focus();
		return false;
	}
	
	
	obj=document.forms[0].txtyemail;
	if (! isValidEmail(obj.value))
	{
		alert("Invalid e-Mail-Id entered.");
		obj.focus();
		return false;
	}
	
	

	return true;
   
}

function EnimagesPopup()
{
	mywindow = window.open ("http://www.euronews.net/popup.php?lng=2&lien=stream1.euronews.net:8080/ramgen/new/cut/srilanka_53322_2.rm?usehostname","","scrollbars, width=502, height=460, status,toolbar=Off,menubar=Off");
	return false;
							//window.open('url.htm', 'windowname', 'scrollbars,resizable,status,toolbar,menubar');

}

function Reportanabuse()
{
	obj=document.myform;
	obj.action="contact.php"
	obj.submit();
	return;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

function validContactus()
{


	obj=document.myform;
	
    if(isEmpty(obj.name,"votre Nom"))
        return false;
	
	
	 if(isEmpty(obj.address,"votre address"))
		return false;

	 if (!isValidEmail(obj.email.value))
	 {
			alert("Votre pays de residence.");
			obj.email.focus();
			return false;
	 }
	var flag=false;
	 for(i=0; i<obj.radiobutton.length;i++)
	 {
		 if(obj.radiobutton[i].checked)
		 {
			flag=true;
			break;
		 }
	 }

	  if(flag==false)
	  {
		  alert("Objet de votre message");
		  return false;
	  }
   if(isEmpty(obj.comments,"Commentaires"))
		return false;

	return true;
   
}


function validadvertise()
{


	obj=document.myform;
	
    if(isEmpty(obj.name,"votre Nom"))
        return false;
	
	
	 if(isEmpty(obj.company_name,"compagnie"))
		return false;

	 if (!isValidEmail(obj.email.value))
	 {
			alert("Votre pays de residence.");
			obj.email.focus();
			return false;
	 }
	
   if(isEmpty(obj.message,"Commentaires"))
		return false;

	return true;
   
}

function validreg(NID)
{
	obj=document.myregform.txtusername;
    if(isEmpty(obj,"Username"))
        return false;

	obj=document.myregform.txtpassword;
    if(isEmpty(obj,"Password"))
        return false;
	

	obj=document.myregform.txtemail
    if(!isValidEmail(obj.value))
	{
		alert("Invalid e-Mail-Id entered.");
		obj.focus();
		return false;
	}
	var id=NID;
	insertRegistration('inserregistration.php?param=',id);
return false;
}




function ajaxpaging(url,id)
{

	try 
	{
		http = new XMLHttpRequest(); /* e.g. Firefox */
	} 
	catch(e)
	{
		try 
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");

  /* some versions IE */
		} 
		catch (e) 
		{
			try
			{
				http = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
			} 
			catch (E) 
			{
				 http = false;
			} 
	   } 
	}

	
	var myRandom=parseInt(Math.random()*99999999);  // cache buster
	http.open("GET", url + "" + "&dir=" + "&page="+id+"&rand=" + myRandom, true);

	http.onreadystatechange = handleHttpResponseLeftMenu;
	http.send(null);

	


}
function handleHttpResponseLeftMenu()
{
	if (http.readyState == 4) 
	{
		document.getElementById("weeklist").style.visibility="visible"; 
		document.getElementById("weeklist").innerHTML=http.responseText;
	
	
	}
}

function handleHttpResponseMiddle()
{
	if (http.readyState == 4) 
	{
			
		document.getElementById("middlepane").style.visibility="visible"; 
		document.getElementById("middlepane").innerHTML=http.responseText;
		
	
	
	}
}


function catpane(url,id,pid)
{

	try 
	{
		http = new XMLHttpRequest(); /* e.g. Firefox */
	} 
	catch(e)
	{
		try 
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");

  /* some versions IE */
		} 
		catch (e) 
		{
			try
			{
				http = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
			} 
			catch (E) 
			{
				 http = false;
			} 
	   } 
	}

	
	var myRandom=parseInt(Math.random()*99999999);  // cache buster
	http.open("GET", url + "" + "&dir=" + "&NID="+id+"&page="+pid+"&rand=" + myRandom, true);

	http.onreadystatechange =handleHttpResponseMiddle;
	http.send(null);

	


}

function registrationpopup(NID)
{
	
	mywindow = open ("registration.php?NID="+NID,"","scrollbars, width=270, height=190, status=0,toolbar=Off,menubar=Off");

	mywindow.moveTo(100,250);
	return false;
}



function visiblereg(flag)
{

	obj=document.myregform;

	objA=document.getElementById("regform");
	if(flag=="plus")
	{
		objA.style.display="block";
		obj.cmdsubmit.focus();
	}
	else
		objA.style.display="none";

}




function insertRegistration(url,NID)
{

	try 
	{
		http = new XMLHttpRequest(); /* e.g. Firefox */
	} 
	catch(e)
	{
		try 
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");

  /* some versions IE */
		} 
		catch (e) 
		{
			try
			{
				http = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
			} 
			catch (E) 
			{
				 http = false;
			} 
	   } 
	}

	user=document.myregform.txtusername.value;
	pass=document.myregform.txtpassword.value;
	name=document.myregform.txtname1.value;
	email=document.myregform.txtemail.value;
	
	var myRandom=parseInt(Math.random()*99999999);  // cache buster
	http.open("GET", url + "" + "&dir="+ "&NID="+NID+"&user="+user+"&pass="+pass+"&name="+name+"&email="+email+"&rand=" + myRandom, true);

	http.onreadystatechange =handleHttpResponseinsertRegistration;
	http.send(null);

	


}

function handleHttpResponseinsertRegistration()
{
	if (http.readyState == 4) 
	{
			
		document.getElementById("regmessage").style.visibility="visible"; 
		//alert(http.responseText);
		document.getElementById("regmessage").innerHTML=http.responseText;
		
		
	}
}
function quotepopup(NID,page,cid,name)
{
	
	mywindow = window.open ("category_reply.php?NID="+NID+"&page="+page+"&cid="+cid+"&fromname="+name,"","scrollbars, width=550, height=400, status,toolbar=Off,menubar=Off");
	return false;						

}




function indexNews(url,id)
{

	try 
	{
		http = new XMLHttpRequest(); /* e.g. Firefox */
	} 
	catch(e)
	{
		try 
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");

  /* some versions IE */
		} 
		catch (e) 
		{
			try
			{
				http = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
			} 
			catch (E) 
			{
				 http = false;
			} 
	   } 
	}

	
	var myRandom=parseInt(Math.random()*99999999);  // cache buster
	http.open("GET", url + "" + "&dir=" + "&page="+id+"&rand=" + myRandom, true);

	http.onreadystatechange = handleHttpResponseIndexNews();
	http.send(null);

	


}
function handleHttpResponseIndexNews()
{
	if (http.readyState == 4) 
	{
		document.getElementById("randomnewsdiv").style.visibility="visible"; 
		document.getElementById("randomnewsdiv").innerHTML=http.responseText;
	
	
	}
}







function commentspane(id) {
	
    var xmlHttpReq = false;

    var self = this;

    
    if (window.XMLHttpRequest) {

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) {

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }
     
    self.xmlHttpReq.open('POST', 'commentlist.php', true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() 
	{
        if (self.xmlHttpReq.readyState == 4) {
            //alert(self.xmlHttpReq.responseText);
            updatepageuploadComments(self.xmlHttpReq.responseText);

            

     }

    }
   	
    self.xmlHttpReq.send(CommentsBussiness(id));
	

}



function CommentsBussiness(id) 
{    
		
    var url="";
	
	url=url+"id="+id;
	url=url+"&act=close";
	
	return url;

}



function updatepageuploadComments(str)
{
	document.getElementById("Cdiv").style.display="block";
	document.getElementById("Cdiv").innerHTML =str;
	


}





//*********************Ajax Codeing For Image of the week ********************************
function xmlhttpPost_NewsImage(strURL, newsid) {
	
	var xmlHttpReq = false;

    var self = this;

    // Mozilla/Safari

    if (window.XMLHttpRequest) {

        self.xmlHttpReq = new XMLHttpRequest();
    }

    // IE

    else if (window.ActiveXObject) {

    self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }

    self.xmlHttpReq.open('POST', strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState == 4) {

           display_NewsImage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring_NewsImage(newsid));
}

function getquerystring_NewsImage(newsid) {

	//var form = document.forms['myform'];

   // var word =  document.getElementById(TextBoxName).value;

	//var valu = eval("document.myform."+ComboName+".value");

    qstr = "newsid=" + newsid ;  // NOTE: no '?' before querystring
	
	return qstr;
}

function display_NewsImage(str) 
{
	
	 document.getElementById("bigImage").innerHTML = str;

}
//##################################################################################################



