// JavaScript Document
/******* Jump to Games ***********/



function dropdown(mySel)
{
var myWin, myVal , language;

myVal = mySel;
if (myVal == "Jump") return false;
if(myVal)
   {
   if(mySel.target)myWin = parent[mySel.target];
   else myWin = window;
   if (! myWin) return true;
   language = cookie_read("language")
   //alert(language+myVal);
   if (language == "" || mySel=='http://fantasycricket.games2win.com/')
   	myWin.location = "/en"+myVal;
   else
   	myWin.location = "/"+language+myVal;
   //myWin.open(myVal);
   }
return false;
}
function ajaxLoader(url,id)
{
	 dojo.xhrGet({
    url: url,
    load: function(response, ioArgs){
      dojo.byId(id).innerHTML = response;
      return response;
    },
    error: function(response, ioArgs){
      dojo.byId(id).innerHTML = "An error occurred" ;
      return response;
    },
    handleAs: "text"
  });
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function resetVal(val)
	{
		frm = document.forms["frm_Subscribe"]
		if((frm.emailid.value=="Type in your email ID") && val=="emailid")
		{
			frm.emailid.value="";
		}		
	}
function setVal(val)
	{
		frm = document.forms["frm_Subscribe"]

		if((frm.emailid.value=="") && val=="emailid")
		{
			frm.emailid.value="Type in your email ID";
		}
		
	}
	
function check_Validate() 
{
frm = document.forms["frm_Subscribe"]	

	if (!isEmailAddr(frm.emailid.value)) 
  	{
		alert("Email address seems incorrect");
		frm.emailid.focus();
		frm.emailid.select();
		return (false);
	}
	else
	{
		window.open ('','newsletter','scrollbars=yes,status=no,width=520,height=250')
		frm.method="post";
		frm.target="newsletter";
		frm.action="/submit_subscribe.asp";	
		frm.submit();
		frm.action="";
		frm.target="";
	}
  return false;
}


function sendSubscribe(frm)
{
	// alert("fff")
	 frm.preventDefault(); // prevent the natural submit action of the form
	 frm = document.forms["frm_Subscribe"]	

	
	if(!frm.gender[0].checked && !frm.gender[1].checked)
	{
		dojo.byId('subMessage').innerHTML = "Please choose your gender!";
		return false;
	}	
	if (frm.age.value == "")
	{
		dojo.byId('subMessage').innerHTML = "Please enter your age!";
		frm.age.focus();
		return false;
	}
	else if(!frm.age.value.match(/^\d+$/))
	{
		dojo.byId('subMessage').innerHTML = "Please enter only digits in your age!";
		frm.age.select();
		return false;
	}
	
	if (!isEmailAddr(frm.emailid.value)) 
  	{
		dojo.byId('subMessage').innerHTML = "Please enter a valid Email Id!";
		frm.emailid.focus();
		frm.emailid.select();
		return (false);
	}
	
	dojo.byId('subMessage').innerHTML = '<img src="/images/ajax-loader.gif" border="0">';
    dojo.xhrPost ({
                        url: '/submit_subscribe.asp',
                        form: 'frm_Subscribe',
                        load: function (data) {
							if (data == '1')
							{
                                dojo.byId('gamealert_inner').innerHTML = '<div style="margin-top:40px;font-weight:bold;text-align:justify">Thank you! Now you will never miss out on our new games.</div><div style="margin-top:20px;text-align:center"><input type="button" value="Close" onclick="javascript:tooltipHide(\'gamealert_form\');" /></div>';
							} else {
								dojo.byId('subMessage').innerHTML = data;	
							}
								
                        },
                        error: function (error) {
                                //console.error ('Error: ', error);
								dojo.byId('subMessage').innerHTML = 'An error occurred';
                        }
            });
}
//validate and submit comments
function check_Comment() 
{
frm = document.forms["frm_writeComment"]	

	if (frm.author.value == "")
	{
		alert("Please enter your name!");
		frm.author.focus();
		return false;
	}
	if (!isProperName(frm.author.value))
	{
		alert("Invalid characters in Name")
		frm.author.focus();
		frm.author.select();
		return false;
	}
	
	if (frm.country.value == "")
	{
		alert("Please select your country");
		return false;
	}
	if (frm.comment.value == "")
	{
		alert("Please enter a comment");
		return false;
	}
	
		window.open ('','comments','scrollbars=yes,status=no,width=490,height=420')
		frm.method="post";
		frm.target="comments";
		frm.action="/blog/wp-comments-post.php";	
		frm.submit();
		frm.action="";
		frm.target="";
		cookie_create('user_name',frm.author.value,365);
		cookie_create('user_country',frm.country.value,365);
  return false;
}	

function isProperName(string)
	{
		if (string.search(/^\w+( \w+)?$/) != -1)
			return true;
		else
			return false;
	}
// BZ:381 This version of isEmailAddr updated from the SendComment code
function isEmailAddr(email)
{
  			invalid = "#-~/:<>`|^!';$%^&*()+|=";
			charvalue = email;
			for(i=0;i<invalid.length;i++)
			{
				for(j=0;j<invalid.length;j++)
				{
					if(charvalue.charAt(j) ==  invalid.charAt(i))
					{
						return(false);
					}
				}
			}
  
  if(email.match(" ") == " ")
	{
		return false;
	}
	if(email.indexOf(".") == -1 || email.indexOf("@") == -1)
	{
		return false;
	}
	if(email.indexOf(".") == 0 || email.lastIndexOf("@") == email.length-1 || email.lastIndexOf(".") == email.length-1 || email.indexOf("@") == 0)
	{
		return false;
	}
	if(email.match(".@")==".@" || email.match("@.")=="@.")
	{
		return false;
	}
	if(email.lastIndexOf(".")<email.lastIndexOf("@"))
	{
		return false;
	}
  return true;
  }

 function send(url,gameurl,gamename,id)
	{
		//alert(gameurl)
		send_url = url+"?ref="+gameurl+"&gamename="+gamename
		
		if (document.getElementById) {
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			}
			if (x)
				{
			x.onreadystatechange = function()
					{
						
				if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(id);
						el.innerHTML = x.responseText;
						
					}
					}
					//alert(id);
				x.open("GET", send_url, true);
				x.send(null);
				}
	    }
function cookie_create( name, value, days ) {

	if ( days ) {
		var date = new Date();
		date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) );
		var expires = "; expires=" + date.toGMTString();
	} else {
		var expires = "";
	}
	
	document.cookie = name + "=" + value + expires +"; path=/";
}
	
function cookie_read( name ) {

	var nameEQ = name + "=";
	var ca = document.cookie.split( ';' );
		
	for( var i = 0; i < ca.length; i++ ) {
		var c = ca[i];
		while ( c.charAt(0) == ' ' ) c = c.substring( 1, c.length );
		if ( c.indexOf( nameEQ ) == 0 ) return c.substring( nameEQ.length, c.length );
	}
	
	return "";
	
}
	
function cookie_erase( name ) {
	createCookie( name, "", -1 );
}
function corporate_open(url)

{

	corprate_window = window.open (url,'corporate','top=50,left=200,menubar,toolbar,location,resizable,scrollbars,status,width=760,height=500').focus();	

}
function UGCSend2friend(game_id,level_id)

{
	//alert(level_id)
	UGCSend2friend_window = window.open ('http://www.games2win.com/ugc/send2friend.asp?game_id='+game_id+'&level_id='+level_id,'send2friend','top=50,left=200,scrollbars=no,status=no,width=500,height=440').focus();	

}
function sethomepage()
					{
						var browser=navigator.appName
						if (browser=="Netscape")
						  {alert("1. Drag the Link and drop it onto the House icon above\n2. Select Yes from the pop up window ")
						  				}
						else if (browser=="Microsoft Internet Explorer")
						  {
							  document.body.style.behavior='url(#default#homepage)';
							  document.body.setHomePage('http://www.games2win.com');
						  }
					}


//*************************BZ:275 - Game pre-rolls on our site *********************************************

//For Displying ads	on Game Page //////////////////////////////////////////////////////////
function adDisply(game_id)
{

// BZ:527 this check for iviz_pre is only precautionary, in case the JS is uploaded, but the pages never generate the ivizi_pre variable.
if ( typeof( window[ 'iviz_pre' ] ) != "undefined" ) 
  {				
	if (iviz_pre)
	   {						
	//BZ:400 Always display the ad, regardless of the previous page the player was at.  Display for 20seconds.
	//BZ:422 back to 15 seconds		
	display(); 
	var t=setTimeout("show()",15000);
	    }			
   } 
 else
{
display();				
var t=setTimeout("show()",15000);							
}
}
//Show ads  ////////////////////////////////////////////////////////////////////
function show(){
						
				dojo.byId('ad_container').style.display = 'none';
				dojo.byId('game_container').style.display = '';
				//dojo.byId('game_container').innerHTML = game_embed_code;
				game_loaded = true;
				if(typeof( window[ 'iviz_pre' ] ) != "undefined"&&iviz_pre)
				{
				preloadInt=setInterval("timerEvent()",50)
				}
}
//BZ:400 Timer now 20 seconds
//BZ:422 back to 15 seconds
// Shows Timer From 15 to 0 /////////////////////////////////////////////////////
 var milisec=0 
 var seconds=15 
							
function display(){ 
							 if (milisec<=0){ 
								milisec=9 
								seconds-=1 
							 } 
							 if (seconds<=-1){ 
								milisec=0 
								seconds+=1 
							 } 
							 else 
								milisec-=1 
							document.getElementById('ad_counter').innerHTML=seconds 
							setTimeout("display()",100) 
							} 
							 
							
//Progres Bar Function////////////////////////////////////////////////////////

var mInterval;

function startProgressBar() {
	reset();
	mInterval = setInterval("doProgress()",65);
}

function reset() {
	document.getElementById("mask").style.left = "0px";
	document.getElementById("mask").style.width = document.getElementById("mContainer").offsetWidth + "px";
	document.getElementById("progressIndicator").style.zIndex  = 10;
	//document.getElementById("mask").style.display = "block";
	//document.getElementById("progressIndicator").innerHTML = "0%";
}

function doProgress() {
	curWidth = parseInt(document.getElementById("mask").offsetWidth);
	curLeft = parseInt(document.getElementById("mask").offsetLeft);
	curWidth --;
	curLeft ++;

	if(curLeft ==201) {
		clearInterval(mInterval);
		document.getElementById("mask").style.display = "none";
		return;
	}


	document.getElementById("mask").style.left = curLeft + "px";
	if(parseInt(document.getElementById("mask").offsetWidth)>10)document.getElementById("mask").style.width = curWidth + "px";
	//document.getElementById("progressIndicator").innerHTML = Math.floor((curLeft / parseInt(document.getElementById("gradient").offsetWidth))*100) + "%";

}
//Chat Pop UP

function popup(url,width,height){
	
	popup_window =window.open (url,'terms','scrollbars=no,status=no,width='+width+',height='+height+'').focus();
}


function valid_name(name,field){
	
		invalid = ".#@_-~/:<>`|^!';$%^&*()+|=1234567890";
			charvalue = name.value;
			for(i=0;i<invalid.length;i++)
			{
				for(j=0;j<invalid.length;j++)
				{
					if(charvalue.charAt(j) ==  invalid.charAt(i))
					{
						alert("Only valid characters are allowed in "+field+"!") ;
						name.select();  
						return(false);
					}
				}
			}
			var spacecount = 0
			for(i=0;i<charvalue.length;i++)
			{
				if(charvalue.charAt(i) == " ")
				{   
					spacecount++ ;
					if (spacecount == charvalue.length)
					{
					alert("Only valid characters are allowed in "+field+"!") ;
					return(false);
					}		
				}
			}
		return true;
	}
function valid_comment(name,field){
	
		invalid = "#@_-~/:<>`|^!';$%^&*()+|=";
			charvalue = name.value;
			for(i=0;i<invalid.length;i++)
			{
				for(j=0;j<invalid.length;j++)
				{
					if(charvalue.charAt(j) ==  invalid.charAt(i))
					{
						alert("Only valid characters are allowed in "+field+"!") ;
						name.select();  
						return(false);
					}
				}
			}
			var spacecount = 0
			for(i=0;i<charvalue.length;i++)
			{
				if(charvalue.charAt(i) == " ")
				{   
					spacecount++ ;
					if (spacecount == charvalue.length)
					{
					alert("Only valid characters are allowed in "+field+"!") ;
					return(false);
					}		
				}
			}
		return true;
	}

	
	
function submit_challenge() 
{
	frm = document.forms["frm_challengeFriends"]	
	//--------------------------name and email------------------------------------
	if(frm.senderName.value == "")
		{
			alert("Please enter your name!");
			frm.senderName.focus();
			return false;
		}
	if(!valid_name(frm.senderName,'Name'))
	{
	return false;
	}	
	
	if(frm.senderEmail.value == "")
		{
			alert("Please enter your Email Id!");
			frm.senderEmail.focus();
			return false;
		}
	if(!isEmailAddr(frm.senderEmail.value))
	{
		alert("Please enter a valid Email Id!");
		frm.senderEmail.select();
		return false;
	}
	var	condition_all_names = frm.name1.value =="" && frm.name2.value =="" && frm.name3.value == ""
		
	if(condition_all_names)
	{
		alert("Please enter your friend's Name!");
		frm.name1.focus();
		return false;
		all_blank_names_flag = 1;
	}
	
	var	condition_all_emails = frm.email1.value =="" && frm.email2.value =="" && frm.email3.value =="" 
	
	if(all_blank_names_flag=1 && condition_all_emails)
	{
		alert("Please enter your friend's Email ID!");
		//frm.email1.focus();
		return false;
		all_blank_email_flag = 1;
	
	}
	
	//--------------------------name and email------------------------------------
		if (frm.name1.value == "" && frm.email1.value != "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.name1.focus();
		return false;
	}
	if (frm.name1.value != "" && frm.email1.value == "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.email1.focus();
		return false;
	}
	
	if (frm.name2.value == "" && frm.email2.value != "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.name2.focus();
		return false;
	}
	if (frm.name2.value != "" && frm.email2.value == "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.email2.focus();
		return false;
	}
	
		if (frm.name3.value == "" && frm.email3.value != "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.name3.focus();
		return false;
	}
	if (frm.name3.value != "" && frm.email3.value == "")
	{
		alert("Please enter your friend's Name and Email ID!");
		frm.email3.focus();
		return false;
	}
	
	//-------------------------------check for repeated email-------------------------------------

	if (frm.email1.value != "")
	{
		if ((frm.email1.value == frm.email2.value) || (frm.email1.value == frm.email3.value) )
		{
			alert("You have entered same Email ID more than once!");
				return false;
		}
		if(!isEmailAddr(frm.email1.value))
		{
			alert("Invalid Email Id!")
			return false;
		}
	}
	
	if (frm.email2.value != "")
	{
		if ((frm.email2.value == frm.email1.value) || (frm.email2.value == frm.email3.value) )
		{
			alert("You have entered same Email ID more than once!");
				return false;
		}
		if(!isEmailAddr(frm.email2.value))
		{
			alert("Invalid Email Id!")
			return false;
		}
		
	}
	
		if (frm.email3.value != "")
	{
		if ((frm.email3.value == frm.email1.value) || (frm.email3.value == frm.email2.value) )
		{
			alert("You have entered same Email ID more than once!");
				return false;
		}
		if(!isEmailAddr(frm.email3.value))
		{
			alert("Invalid Email Id!")
			return false;
		}
	}
	

	window.open ('','challengefriends','scrollbars=yes,status=no,width=490,height=420')
	//alert("ff");
	frm.method="post";
	frm.target="challengefriends";
	frm.action="/challenge_friends.asp";
	frm.ref.value = document.URL
	//alert(frm.ref.value);
	frm.submit();
	frm.action="";
	frm.target="";
	frm.challengername="";
	frm.email1.value="";
	frm.email2.value="";
	frm.name1.value="";
	frm.name2.value="";
	frm.email3.value="";
	frm.name3.value="";
}

function onlyNumbers(inputString)
{
  var searchForNumbers = /\D+\_+\W+\s+\S+/
  return ((searchForNumbers.test(inputString)) ? false : true)
}

function  getCommentsV3(game_id, pgNum){
	//game_id = 3
	//dojo.byId("commentsContainer").innerHTML = '<div class="stepLinksDiv" style="text-align:center;padding-top:20px;padding-bottom:20px"><img src="/images/ajax-loader.gif" border="0"></div>';
    dojo.xhrGet({
    //url: 'http://192.168.0.93/recentCommentDummy.xml' , //
	handleAs: "xml",
	url: "/blog/?feed=rss2&p=" + game_id ,
    load:function(response, ioArgs){
		//alert(showCommentsV3(response, game_id, pgNum));
		//alert(response);
      dojo.byId("commentsContainer").innerHTML = showCommentsV3(response, game_id, pgNum) ;
      return response;
    },
    error:function(response, ioArgs){
		  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		  xmlDoc.async="false";
		  xmlDoc.loadXML(ioArgs.xhr.responseText);
      dojo.byId("commentsContainer").innerHTML = showCommentsV3(xmlDoc, game_id, pgNum) ;
        //"Data currently unavailable" ;
	//alert(response);
      return response;
    }
    
  });
}
  function showCommentsV3(xmlComments, game_id, pgNum) {
		var index_comment;
		var index_user;
		var Comments = xmlComments.getElementsByTagName("item") ;
		var commentCount = Comments.length;
		var pgSize = 3 ;
		var pgCount;
		var pgStart;
		var pgEnd;
		if (commentCount < pgSize) {pgCount = 1;}
		else if (commentCount % pgSize == 0) {
			pgCount = commentCount/pgSize;
		}
		else {
			pgCount	= Math.floor(commentCount/pgSize) + 1;
		}
		pgStart = (pgNum - 1) * pgSize ;
		if  ((pgStart + pgSize + 1) > commentCount)  {
			pgEnd = commentCount - 1 ;
		}
		else {
			pgEnd = (pgStart - 1) + pgSize ;
		}
		var strHTML = "";	   
		for(i = pgStart; i <= pgEnd; i++) {
			if (navigator.userAgent.indexOf("IE") >= 0) {		
				index_comment = 6;
				index_country = 7;
				index_user = 0;
				strHTML +=  "<div class=\"commentInfo\"><div class=\"cmntMsg\" >" + Comments.item(i).childNodes.item(index_comment).text + "</div>";
				strHTML +=  "<div class=\"cmntName\">Posted " +  Comments.item(i).childNodes.item(index_user).text + ", Country: " + Comments.item(i).childNodes.item(index_country).text + "</div><div class=\"clearBoth\"></div></div>";
			} else {
				index_comment =13;
				index_country =15;
				index_user = 1;
				strHTML +=  "<div class=\"commentInfo\"><div class=\"cmntMsg\" >" + Comments.item(i).childNodes.item(index_comment).textContent + "</div>";
				strHTML +=  "<div class=\"cmntName\">Posted " + Comments.item(i).childNodes.item(index_user).textContent + ", Country: " + Comments.item(i).childNodes.item(index_country).textContent +"</div><div class=\"clearBoth\"></div></div>";
			}
		}
		if (pgCount > 1) {
			strHTML +=  "<div class=\"stepLinks rcstepLink dbfr\" style=\"margin-top: 2px;\"><p>";
			if (pgNum > 1) {
				strHTML +=  "<a href='javascript:void(0);' onclick='getCommentsV3(" + game_id + "," + (pgNum - 1) + ")'><img border='0' src='/images/leftAro.gif' alt='Previous'> Previous</a>";
			}
			for (i = 1; i <= pgCount; i++) {
				if (i == pgNum) {
					strHTML += " <span>" + i + "</span> |";
				} else {
					strHTML += " <a href='javascript:void(0);' onclick='getCommentsV3(" + game_id + "," + i + ")'>" + i + "</a> |";
				}
			}
			if (pgNum < pgCount) {
				strHTML +=  "<a href='javascript:void(0);' onclick='getCommentsV3(" + game_id + "," + (pgNum + 1) + ")'>Next <img border='0' src='/images/nextAro.gif' alt='Next'></a>";
			}
			strHTML += "</p></div><div class=\"clearBoth\"/>";
		}
		return strHTML ;
  }

 function  getComments(game_id, pgNum){
	//game_id = 3
	dojo.byId("commentsContainer").innerHTML = '<div class="stepLinksDiv" style="text-align:center;padding-top:20px;padding-bottom:20px"><img src="/images/ajax-loader.gif" border="0"></div>';
  dojo.xhrGet({
    //url: '/rss_test.xml' , //
	handleAs: "xml",
	url: "/blog/?feed=rss2&p=" + game_id ,
    load: function(response, ioArgs){
		
      dojo.byId("commentsContainer").innerHTML = showComments(response, game_id, pgNum) ;
      return response;
    },
    error: function(response, ioArgs){
		  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		  xmlDoc.async="false";
		  xmlDoc.loadXML(ioArgs.xhr.responseText);
		  
		  
      dojo.byId("commentsContainer").innerHTML = showComments(xmlDoc, game_id, pgNum) ;
        //"Data currently unavailable" ;
	//alert(ioArgs.xhr.responseText);
      return response;
    }
    
  });
}
 
 
  function showComments(xmlComments, game_id, pgNum)
  {
		
		var index_comment;
		var index_user;
		
		
		var Comments = xmlComments.getElementsByTagName("item") ;
		
		if (Comments.length == 0) { 
			dojo.byId("no_of_comments").innerHTML = '<p class="dbfl">' + Comments.length + '</p>' ; 
			return '<div class="stepLinksDiv" style="text-align:center;padding-top:20px;padding-bottom:20px">No one has commented on this game!</div>'
		}
		dojo.byId("no_of_comments").innerHTML = '<p class="dbfl">' + Comments.length + ' (<a href="#recentComments" class="readGrey"> Read</a>)</p>' ; 

		var commentCount = Comments.length;
		var pgSize = 8 ;
		var pgCount;
		var pgStart;
		var pgEnd;
		//-------------Calculate the number of pages ------------------------------------------
		if (commentCount < pgSize) {
			pgCount = 1
		}
		else if (commentCount % pgSize == 0) {
			pgCount = commentCount/pgSize
		}
		else {
			pgCount	= Math.floor(commentCount/pgSize) + 1
		}
		
		//--------------- Calculate the start and end positions for the page ----------------------------
		pgStart = (pgNum - 1) * pgSize ;
		if  ((pgStart + pgSize + 1) > commentCount)  {
			pgEnd = commentCount - 1 ;
		}
		else {
			pgEnd = (pgStart - 1) + pgSize ;
		}
			
		
		var strHTML = "<div class='stepLinksDiv'>"
		strHTML += "<ul class='recentComments'>"
		
		//--------------- List Comments ----------------------------		   
		for(i = pgStart; i <= pgEnd; i++)
		{
			if ((i % 2) == 0) {
				strHTML +=  "<li class='comment2'>"
			}
			else {
				strHTML +=  "<li class='comment1'>"
			}
			//alert(pgStart  + 'ff' + pgEnd + 'gg' + i)
			//var temp = Comments.item(i) //.childNodes.item(13).textContent
			//var temp_1 = Comments.item(i).childNodes.item(13)
			//var temp_2 = xmlComments.namedItem("content:encoded")
			//alert( xmlComments.getElementsByTagName("content:encoded").item(0).textContent)
			//return "ff"
			
			if (navigator.userAgent.indexOf("IE") >= 0)
			{		
				index_comment = 6;
				index_country = 7;
				index_user = 0;
				strHTML +=  "" + Comments.item(i).childNodes.item(index_comment).text + ""
				strHTML +=  "<br class='clearMod'><p class='greenTxt'>Posted " +  Comments.item(i).childNodes.item(index_user).text + "</p>"
				strHTML +=  "<br class='clearMod'><p class='greenTxt'>Country: "+Comments.item(i).childNodes.item(index_country).text +"</p>"
				strHTML +=  "</li>"

			}
			else
			{
				index_comment = 13;
				index_country = 15;
				index_user = 1;
				strHTML +=  "" + Comments.item(i).childNodes.item(index_comment).textContent + ""
				strHTML +=  "<br class='clearMod'><p class='greenTxt'>Posted " + Comments.item(i).childNodes.item(index_user).textContent + "</p>"
				strHTML +=  "<br class='clearMod'><p class='greenTxt'>Country: " + Comments.item(i).childNodes.item(index_country).textContent +"</p>"
				strHTML +=  "</li>"
			}
				
			
		}
		
			strHTML +=  "</ul></div>"
			
			//---------------------- Paging -----------------------------

		if (pgCount > 1) {
			
			strHTML +=  " <div class='stepLinks rcstepLink dbfl'><p>"
			
			// -------Previous link
			if (pgNum > 1) {
				strHTML +=  "<a href='javascript:void(0);' onclick='getComments(" + game_id + "," + (pgNum - 1) + ")'><img border='0' src='/images/leftAro.gif' alt='Previous'> Previous</a>"
			}
			
			// -------- List the Page numbers
			for (i = 1; i <= pgCount; i++)
			{
				if (i == pgNum) {
					strHTML += "<span>" + i + "</span>|"
				}
				else {
					strHTML += "<a href='javascript:void(0);' onclick='getComments(" + game_id + "," + i + ")' class='pageNo'>" + i + "</a>|"
				}
			}
			
			//-------- Next link
			if (pgNum < pgCount) {
			strHTML +=  "<a href='javascript:void(0);' onclick='getComments(" + game_id + "," + (pgNum + 1) + ")'>Next <img border='0' src='/images/nextAro.gif' alt='Next'></a>"
			}
			
			strHTML += "</p></div>"
		}
		return strHTML ;
  }
  
  function setCountryLanguage(lang,country,page_name)
  {
	 
	  cookie_create('language',lang,365);
	  cookie_create('country',country,365);
	 // dojo.addClass(country, 'selected_flag')
	// alert('/' + lang + page_name)
	 setTimeout(function(){
			window.location='/' + lang + page_name;
		}, 0);
	  //window.location.href='/' + lang + page_name;
  }
  
  function highlight_flag()
  {
	country = cookie_read("country") ;  
	if ((country != '') && (dojo.byId(country) != null) ) {
	  dojo.addClass(country, 'selected_flag');
	  dojo.byId(country).parentNode.style.margin = '0px'
	  }
	
  }
  
   function cleanWhitespace(node) {
      var notWhitespace = /\S/;
      for (var i=0; i < node.childNodes.length; i++) {
          var childNode = node.childNodes[i];
          if ((childNode.nodeType == 3)&&(!notWhitespace.test 
 ( childNode.nodeValue))) {
              // that is, if it's a whitespace text node
              node.removeChild(node.childNodes[i]);
              i--;
          }
          if ( childNode.nodeType == 1) {
              // elements can have text child nodes of their own
              cleanWhitespace(childNode);
          }
      }
 }
    	  