var min=13;
var max=17;
function fontIcress() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}

function fontDecress() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

function email(myurl)
{
	//if(varify)
	//{
	window.open("/home/emailtofriend.php?myurl="+myurl,'Email','left=100,top=100,height=600,width=600,scrollbars=no,statusbar=no,toolbars=no,resizable=no')
	/*}
	else
	{
	window.open("/home/emailtofriend.php?myurl="+myurl,'Email','left=100,top=100,height=600,width=600,scrollbars=no,statusbar=no,toolbars=no,resizable=no')

	}*/
}

function comment(storyvalue,categoryvalue,varify)
{
	if(varify)
	{
	window.open("/home/comment.php?storyvalue="+storyvalue+"&locatiopnvalue="+categoryvalue,'Comment','left=100,top=100,height=600,width=600,scrollbars=no,statusbar=no,toolbars=no,resizable=no')
	}
else
	{
	window.open("/home/comment.php?storyvalue="+storyvalue+"&categoryvalue="+categoryvalue,'Comment','left=100,top=100,height=600,width=600,scrollbars=no,statusbar=no,toolbars=no,resizable=no')
	}
}

function printpage(storyvalue,categoryvalue,varify)
{
if(varify)
{
var x=window.open("/home/detailheadlinepage.php?storyvalue="+storyvalue+"&locatiopnvalue="+categoryvalue);
}
else
{
var x=window.open("/home/detailheadlinepage.php?storyvalue="+storyvalue+"&categoryvalue="+categoryvalue);
}
}

function changeStar(myRating)
{
		
			
						if (myRating==1)
						{	
							document.getElementById('1').src=document.getElementById('1').src.replace('star1.gif','star2.gif');		
							document.getElementById('2').src=document.getElementById('2').src.replace('star2.gif','star1.gif');
							document.getElementById('3').src=document.getElementById('3').src.replace('star2.gif','star1.gif');
							document.getElementById('4').src=document.getElementById('4').src.replace('star2.gif','star1.gif');
							document.getElementById('5').src=document.getElementById('5').src.replace('star2.gif','star1.gif');
						
						}
					else if (myRating==2)
					{
					
						document.getElementById('1').src=document.getElementById('1').src.replace('star1.gif','star2.gif');		
						document.getElementById('2').src=document.getElementById('2').src.replace('star1.gif','star2.gif');
						document.getElementById('3').src=document.getElementById('3').src.replace('star2.gif','star1.gif');
						document.getElementById('4').src=document.getElementById('4').src.replace('star2.gif','star1.gif');
						document.getElementById('5').src=document.getElementById('5').src.replace('star2.gif','star1.gif');
					
					}
				else if (myRating==3)
					{
					
						document.getElementById('1').src=document.getElementById('1').src.replace('star1.gif','star2.gif');		
						document.getElementById('2').src=document.getElementById('2').src.replace('star1.gif','star2.gif');
						document.getElementById('3').src=document.getElementById('3').src.replace('star1.gif','star2.gif');
						document.getElementById('4').src=document.getElementById('4').src.replace('star2.gif','star1.gif');
						document.getElementById('5').src=document.getElementById('5').src.replace('star2.gif','star1.gif');
					
					}
					else if (myRating==4)
					{
					
						document.getElementById('1').src=document.getElementById('1').src.replace('star1.gif','star2.gif');		
						document.getElementById('2').src=document.getElementById('2').src.replace('star1.gif','star2.gif');
						document.getElementById('3').src=document.getElementById('3').src.replace('star1.gif','star2.gif');
						document.getElementById('4').src=document.getElementById('4').src.replace('star1.gif','star2.gif');
						document.getElementById('5').src=document.getElementById('5').src.replace('star2.gif','star1.gif');
					
					}
					else if (myRating==5)
					{
					
						document.getElementById('1').src=document.getElementById('1').src.replace('star1.gif','star2.gif');		
						document.getElementById('2').src=document.getElementById('2').src.replace('star1.gif','star2.gif');
						document.getElementById('3').src=document.getElementById('3').src.replace('star1.gif','star2.gif');
						document.getElementById('4').src=document.getElementById('4').src.replace('star1.gif','star2.gif');
						document.getElementById('5').src=document.getElementById('5').src.replace('star1.gif','star2.gif');
					
					}

			}
function replaceStar(myRating)
{
			document.getElementById('1').src=document.getElementById('1').src.replace('star2.gif','star1.gif');	
			document.getElementById('2').src=document.getElementById('2').src.replace('star2.gif','star1.gif');
			document.getElementById('3').src=document.getElementById('3').src.replace('star2.gif','star1.gif');
			document.getElementById('4').src=document.getElementById('4').src.replace('star2.gif','star1.gif');
			document.getElementById('5').src=document.getElementById('5').src.replace('star2.gif','star1.gif');	
}




/*********Ajax code************/

var xmlHttp
var str_Html="";
var zero=0
	function downrelatednews()
	{ 
var count=parseInt(document.getElementById("relatednewsLast").value)+1;
		if(document.getElementById("DIV_"+count)!=null)
		{


			document.getElementById("changeRelatedNews").innerHTML="";
			document.getElementById("changeRelatedNews").innerHTML=document.getElementById("DIV_"+count).innerHTML
			document.getElementById("relatednewsLast").value=parseInt(document.getElementById("relatednewsLast").value)+1;
			//alert(document.getElementById("changeRelatedNews").className);
		}
		else
		{
			
			return false;
		}
	}

function uprelatednews()
{ //
//alert(document.getElementById("relatednewsfirstaw").value)
		var count=parseInt(document.getElementById("relatednewsLast").value)-1;
		if(document.getElementById("DIV_"+count)!=null)
		{
			document.getElementById("changeRelatedNews").innerHTML="";
			document.getElementById("changeRelatedNews").innerHTML=document.getElementById("DIV_"+count).innerHTML
			document.getElementById("relatednewsLast").value=parseInt(document.getElementById("relatednewsLast").value)-1;
		}
		else
		{

			return false;
		}
		
}




function ReadComment(storyvalue,categoryvalue)
{ 
	document.getElementById("displaycomment").style.display="block"
	var frmscroll=document.getElementById("frmdetail");
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/home/readcomment.php"
url=url+"?storyvalue="+storyvalue
url=url+"&sid="+Math.random()
url=url+"&categoryvalue="+categoryvalue
xmlHttp.onreadystatechange=stateReadComment
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateReadComment()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var bb=document.getElementById("allcomment").innerHTML=xmlHttp.responseText 
 } 
}


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 abusereports(str,newsvalue,storyvalue,categoryvalue)
{

	window.open("/home/abusereport.php?cmtid="+str+"&newsvalue="+newsvalue+"&storyvalue="+storyvalue+"&categoryvalue="+categoryvalue,'Email','left=100,top=100,height=600,width=600,scrollbars=no,statusbar=no,toolbars=no,resizable=no')
}

		
	function GetRate(val,storyvalue,categoryvalue,storyrattingIp,varify)
	{
	var x=document.getElementById('storyratting').value;
	//alert(x);
	var url;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
	if(storyrattingIp == x)
	{
	alert('Already rated!')
	return false;
	}
	else
	{
		if(varify == "location")
	{
			url="/home/storyrate.php?rate="+val+"&sid="+Math.random()+"&storyvalue="+storyvalue+"&lid="+Math.random()+"&locatiopnvalue="+categoryvalue;
	}
	else
	{
			url ="/home/storyrate.php?rate="+val+"&sid="+Math.random()+"&storyvalue="+storyvalue+"&lid="+Math.random()+"&categoryvalue="+categoryvalue;

	}
	//alert(url);
xmlHttp.onreadystatechange=stateReadRate
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

	}
}

function stateReadRate()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("storyrRate").innerHTML=xmlHttp.responseText 
	 } 
}