// JavaScript Document
/* var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
 if(mine)
    var popUpsBlocked = false
 else
    var popUpsBlocked = true

//alert(popUpsBlocked);

if(popUpsBlocked)
  alert('We have detected that you are using popup blocking software.');
else
	mine.close();
*/	

var contentWin;
function trim( str )  //Added by Hina
{
   return str.replace(/^\s*|\s*$/g,"");
}


/*function openAlert(page_name,heightVal) {
	if (heightVal === undefined) 
	{
    	heightVal = "400";
  	}
	   //Dialog.alert({url: '<?=$siteURL?>/page_include/inc_login.php', options: {method: 'post'}}, {windowParameters: {className: "alphacube"}})
	   Dialog.alert({url: page_name, options: {method: 'get'}}, {className: "alphacube", width:540, height:heightVal, okLabel: "Close"});
	  }*/

function openAlert(fname,height)
{
	var file
	var width = "628";
	var sWidth	= 200
	var sHeight = 200
	
	if(width.length > 0)
	{
		sWidth = width;
	}
	else
	{
		width =100;
	}
	
	if(height.length > 0)
	{
		sHeight = height;
	}
	else
	{
		height =100;
	}
	
	sWidth	= 628;
	sHeight = 400;
	
	//file = siteURL+"/subdomain_login.php";
	
	file = fname.replace("/page_include/inc_login.php", "/subdomain_login.php");
	file = file	
	
	var wintop  =window.screen.availHeight;
	var winleft =window.screen.availWidth;
	wintop  =(wintop/2) -(height/2)
	winleft =(winleft/2) -(width/2)
	//wintop  = 0
	//winleft = 0
	
	if ( sWidth > window.screen.availWidth )
		{ sWidth = window.screen.availWidth; }
	if (sHeight > window.screen.availHeight )
		{ sHeight = window.screen.availHeight; }
	if ( parseInt(sWidth) < width )
		{ sWidth = width; }
	if ( parseInt(sHeight) < height )
		{ sHeight = height; }
	
	if ( navigator.appName == "Microsoft Internet Explorer" )
		{ window.open(file, "_blank", "status=no, addressbar=no, scrollbars=yes, toolbar=no, resizable=no, location=no, menubar=no, top=" + wintop + ", left= "+ winleft +", height=" + sHeight + ", width=" + sWidth); 
		}
	if ( navigator.appName == "Netscape" ) 
		{ 
		window.open(file,"_blank","scrollbars=yes,alwaysRaised,dependant,innerheight=" + sHeight + ",innerwidth=" + sWidth); 		 
		//window.open(file,"_blank","alwaysRaised,dependant,scrollbars=yes,innerheight=" + sHeight + ",innerwidth=" + sWidth); 
		}
}

function callPage(val)
{
	window.location.href	= "destination/"+val;
}

function ChangeImg_over(val)
{
	if (val == 1)
		document.homeImg.src= "images/reserve_fn.jpg";
	else
		document.homeImg.src= "images/reserve_en.jpg";
}

function ChangeImg_out(val)
{
	if (val == 1)
		document.homeImg.src= "images/reserve_f.jpg";
	else
		document.homeImg.src= "images/reserve_e.jpg";
}

function bookmarkme()
{
	var txt = "Bookmark Us!";
	var url = this.location.href;
	var who = "EngageVoter.com";

	var ver = navigator.appName;
	var num = parseInt(navigator.appVersion);
	if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) 
	{
		window.external.AddFavorite(url,who);
	}
	else
	{
		txt = "Press (Ctrl+D) to Add to favorite!";
		alert(txt);
	}
}

function mycenteralpopwinVHS(fname,width,height)
{
	var file
	var sWidth	= 200
	var sHeight = 200
	
	if(width.length > 0)
	{
		sWidth = width;
	}
	else
	{
		width =100;
	}
	
	if(height.length > 0)
	{
		sHeight = height;
	}
	else
	{
		height =100;
	}
	
	file = fname
	file =file	
	
	var wintop  =window.screen.availHeight;
	var winleft =window.screen.availWidth;
	wintop  =(wintop/2) -(height/2)
	winleft =(winleft/2) -(width/2)
	//wintop  = 0
	//winleft = 0
	
	if ( sWidth > window.screen.availWidth )
		{ sWidth = window.screen.availWidth; }
	if (sHeight > window.screen.availHeight )
		{ sHeight = window.screen.availHeight; }
	if ( parseInt(sWidth) < width )
		{ sWidth = width; }
	if ( parseInt(sHeight) < height )
		{ sHeight = height; }
	
	if ( navigator.appName == "Microsoft Internet Explorer" )
		{ window.open(file, "_blank", "status=no, addressbar=no, scrollbars=yes, toolbar=no, resizable=no, location=no, menubar=no, top=" + wintop + ", left= "+ winleft +", height=" + sHeight + ", width=" + sWidth); 
		}
	if ( navigator.appName == "Netscape" ) 
		{ 
		window.open(file,"_blank","scrollbars=yes,alwaysRaised,dependant,innerheight=" + sHeight + ",innerwidth=" + sWidth); 		 
		//window.open(file,"_blank","alwaysRaised,dependant,scrollbars=yes,innerheight=" + sHeight + ",innerwidth=" + sWidth); 
		}
}


 function checkEmpty(frm)
	{
		if(frmPartner.txtUID.value == '')
		{
			alert('Please enter email address.');
			document.frmPartner.txtUID.focus();
			 return false; 
		}	
		else
		{
			var str=frmPartner.txtUID.value;
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(str))
			{
			}
			else
			{
				alert("Please enter a valid email address!")
				return false; 
			}
		}
		if(frmPartner.txtPWD.value == '')
		{
			alert('Please enter password.');
			document.frmPartner.txtPWD.focus();
			return false; 
		}	
		return true;
	}
	

function verifyNumeric(which)
{
	var oldvalue = [''];
    if (isNaN(which.value))
    {
        if (oldvalue[which])
        {
            which.value = oldvalue[which];
        }
        else
        {
            which.value = '';
            oldvalue[which] = '';
        }    
    }
    else
    {
        oldvalue[which] = which.value;
    }
}


function validation()
{
 	var n1 = 0;
	var e1 = 0;
	if(document.frmNews.txtName.value == "")
	{
		alert("Please Enter Name...");	
		document.frmNews.txtName.focus();	
		return false;
		
	}
	else
	{
		r1 = 1;		
	}

	if(document.frmNews.txtEmail.value == "")
	{
		alert("Please Enter Email...");			
		document.frmNews.txtEmail.focus();	
		return false;
	}
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frmNews.txtEmail.value)){
		e1 = 1;	
		return (true);
		}
		else
		{
			alert("Invalid E-mail Address! Please re-enter.")
			return (false);
		}
		
	}	
	if(r1 == 1 && e1 == 1)
	{
		document.frmNews.submit();
	}	
}
 
function FillValues(frm)
{
	if (frm.chkFillHolder.checked)
	{
		frm.txtFName_B.value	= frm.txtFName_D.value;
		frm.txtLName_B.value	= frm.txtLName_D.value;
		frm.txtEmail_B.value	= frm.txtEmail_D.value;
		frm.txtAddress_B.value	= frm.txtAddress_D.value;
		frm.selState_B.value	= frm.selState_D.value;
		frm.txtPostCode_B.value	= frm.txtPostCode_D.value;
		frm.selCountry_B.value	= frm.selCountry_D.value;
		frm.txtPhone_B.value	= frm.txtPhone_D.value;
	}
	else
	{
		frm.txtFName_B.value	= "";
		frm.txtLName_B.value	= "";
		frm.txtEmail_B.value	= "";
		frm.txtAddress_B.value	= "";
		frm.selState_B.value	= "";
		frm.txtPostCode_B.value	= "";
		frm.selCountry_B.value	= "";
		frm.txtPhone_B.value	= "";
	}	
		
}

function displayBilling(val)
{
	var idPmtMethod		= val;
	var idPmtTr			= document.getElementById("idPmtTr");
	var idPmtT1			= document.getElementById("idPmtTr1");
	
	if (idPmtMethod == 3)
	{
		idPmtTr.style.display 		= "block";
		idPmtTr1.style.display 		= "block";
	}	
	else
	{
		idPmtTr.style.display 		= "none";
		idPmtTr1.style.display 		= "none";
	}
}

function CallSecurity(val)
{
	if (val == "Amex")
		document.all.CCsec.innerHTML = "(4 Digits above your account number on the front side)";
	else
		document.all.CCsec.innerHTML = "(Last 3 digits above signature at the back of your card)";
}

function CntryOthr(val)
{
	var idCountry		= document.getElementById("idCntry");
	
	if (val == " Others")
		idCountry.style.display = "block";
	else
		idCountry.style.display = "none";
}

function PrintPage()
{
	window.print();	
	return false;
}

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

/****	Function To Validate the E-Mail to Friend Form    ****/   

function emailto_friend_validate(frm)
{

	if(frm.txtName.value	== "")
	{
		alert("Please Enter Your Name");
		frm.txtName.focus();
		return false;
	}
	if(frm.txtEmail.value	== "")
	{
		alert("Please Enter Your E-Mail Address");
		frm.txtEmail.focus();
		return false;
	}
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.txtEmail.value))
		{
			
		}
		else
		{
			alert("Enter valid Email Address")
			return (false);
		}
	}	
	if(frm.txtFriendName.value	== "")
	{
		alert("Please Enter Friend Name");
		frm.txtFriendName.focus();
		return false;
	}

	if(frm.txtFriendEmail.value	== "")
	{
		alert("Please Enter Friend E-Mail");
		frm.txtFriendEmail.focus();
		return false;
	}
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.txtFriendEmail.value))
		{
			
		}
		else
		{
			alert("Enter Friend's Valid Email Address")
			return (false);
		}
	}	

	if(frm.txtMessage.value	== "")
	{
		alert("Please Enter Message");
		frm.txtMessage.focus();
		return false;
	}
}


/******    E-mail To Friend Function Ends here  *****/

/**** To open and redirect the shadow login popup window -- Added by hina ****/
function shadowChkLogin(frm,siteURL)
{
	xmlHttp_login = GetXmlHttpObject();
	if (xmlHttp_login==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	//var un = encodeURIComponent(name);
	//var pass = encodeURIComponent(password);
	var ref_link = document.getElementById("ref_link").value;
	var ref = "";
	if(ref_link != "")
		ref = "&ref="+ref_link;
	//ref = "&ref="+reflink;
	
	var un = encodeURIComponent(document.getElementById("txtUserName").value);
	var pass = encodeURIComponent(document.getElementById("txtPwd").value);
		
	var url= siteURL+"/page_include/inc_ajaxload_login_validation.php";
	url = url+"?un="+un+"&pass="+pass+ref; 
	xmlHttp_login.onreadystatechange=shadow_stateTagsChanged;
	xmlHttp_login.open("GET",url,true);
	xmlHttp_login.send(null); 
}

function shadow_stateTagsChanged() 
{ 
	if (xmlHttp_login.readyState==4)
	{ 
		var res = xmlHttp_login.responseText; //alert('res...'+res);
		var arr = res.split("||##||");
	/*	for(var i=0;i<=arr.length();i++)
		{
			document.write(arr[i]);
		}*/
		if(arr[0] == 999)
		{
			window.parent.location = arr[1];
		}
		else if(arr[0]!=999)
		{
			//var arr = res.split("##");
			var td_id = 'err_msg';
			alert(arr[0]);
		}
	}
} 
/**** Shadow login popup window ends -- Added by hina ****/


// ----------- Login, Forgot password & Change Password ajax js function -------------------------------
	function chkLogin(frm)
	{
		xmlHttp_login = GetXmlHttpObject();
		if (xmlHttp_login==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var un = encodeURIComponent(document.getElementById("txtUserName").value);
		var pass = encodeURIComponent(document.getElementById("txtPwd").value);
		var ref_link = document.getElementById("ref_link").value;
		
		
		var ref = "";
		if(ref_link != "")
			ref = "&ref="+ref_link;
		var url= siteURL+"/page_include/inc_ajaxload_login_validation.php";
		url = url+"?un="+un+"&pass="+pass+ref; 
		xmlHttp_login.onreadystatechange=login_stateTagsChanged;
		xmlHttp_login.open("GET",url,true);
		xmlHttp_login.send(null); 
	}
	
	function subscribe_for_newsletter(siteURL)
	{
		siteURL	= siteURL||null;
		var ref_link = document.getElementById("ref_link").value;
		var ref = "";

		xmlHttp_newsletter = GetXmlHttpObject();
		if (xmlHttp_newsletter==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var un 		 	 = encodeURIComponent(document.getElementById("txtUserName").value); 
		var emailId  	 = encodeURIComponent(document.getElementById("txtEmailId").value);
		var	seccode	 	 = encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var	seccode_ref	 = encodeURIComponent(document.getElementById("security_refid").value);
		
		if(ref_link != "")
			ref = "&ref="+ref_link;
		//var url= siteURL+"/page_include/inc_ajaxload_subscribe_newsletter.php";
		var url= siteURL+"/inc_ajaxload_subscribe_newsletter.php";
		url = url+"?un="+un+"&email="+emailId+"&secrcode="+seccode+"&secrefcode="+seccode_ref+ref; //alert('url......'+url);
		xmlHttp_newsletter.onreadystatechange=newsletter_stateTagsChanged;
		xmlHttp_newsletter.open("GET",url,true);
		xmlHttp_newsletter.send(null); 
	}
	
	function have_a_say(siteURL)
	{
		siteURL	= siteURL||null; 
		
		xmlHttp_Say = GetXmlHttpObject();
		if (xmlHttp_Say==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var politicianId = document.getElementById("politicianId").value;
		var saysOnTxt  	 = document.getElementById("saysOn").value;
		var saysOn  	 = encodeURIComponent(document.getElementById("saysOn").value);
		var comment 	 = encodeURIComponent(document.getElementById("txtComment").value);
		var	seccode	 	 = encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var	seccode_ref	 = encodeURIComponent(document.getElementById("security_refid").value);
		
		var url	= siteURL+"/page_include/inc_ajaxload_have_your_say.php";
		url 	= url+"?p="+politicianId+"&saysOn="+saysOn+"&comment="+comment+"&secrcode="+seccode+"&secrefcode="+seccode_ref; //alert('emailId..'+url);
		
		//xmlHttp_login.onreadystatechange=login_stateTagsChanged;		
		xmlHttp_Say.onreadystatechange = function ()
											{
												if (xmlHttp_Say.readyState == 4 && xmlHttp_Say.status == 200)
												{
													var resString 	= xmlHttp_Say.responseText;
													var arr 		= resString.split("||##||");	
													if(arr[0] == 999)
													{
														alert("Thank you for adding "+saysOnTxt+". Admin will confirm and update the "+saysOnTxt+" for this politician");
														window.parent.location = arr[1];
													}
													else
													{
														//var arr = res.split("##");
														var td_id = 'err_msg';
														//document.getElementById(td_id).innerHTML = '<tr><td width="100%" align="left" colspan="3" class="white_links">'+res+'</td></tr>';
														alert(arr[0]);
													}
												}
											}
		xmlHttp_Say.open("GET",url,true);
		xmlHttp_Say.send(null); 
	}
	
	function forgotPassword(siteURL)
	{
		siteURL	= siteURL||null; 
		
		xmlHttp_login = GetXmlHttpObject();
		if (xmlHttp_login==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var email = encodeURIComponent(document.getElementById("txtEmail").value);
		var flag = encodeURIComponent(document.getElementById("flag").value);
			
		var url = siteURL+"/page_include/inc_ajaxload_forgot_password.php";
		url = url+"?email="+email+"&flag="+flag;
		xmlHttp_login.onreadystatechange=function ()
										 {
												if (xmlHttp_login.readyState==4)
												{ 
													var res = trim(xmlHttp_login.responseText);
													
													var arr = res.split("||##||");
													var td_id = 'err_msg';
													
													if(arr[0]=='' && arr[1]=='success')
													{
														alert('An email containing login details has been sent to your account');
														window.parent.location = siteURL+'/index.php';	
													}
													else if(arr[0]=='sub' && arr[1]=='success')
													{
														alert('An email containing login details has been sent to your account');
														window.opener.location.href = siteURL+'/index.php';
														window.close();
													}
													else
													{
														if(arr[0]=='sub')
															document.getElementById(td_id).innerHTML = arr[1];
														else
															alert(arr[1]);
													}
												}
										 }
		xmlHttp_login.open("GET",url,true);
		xmlHttp_login.send(null); 
	 }
	
	function changePwd(frm)
	{
		xmlHttp_login = GetXmlHttpObject();
		if (xmlHttp_login==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var ol = encodeURIComponent(document.getElementById("txtuser_pass").value);
		var ne = encodeURIComponent(document.getElementById("txtnew_pass").value);
		var cn = encodeURIComponent(document.getElementById("txtconfirm_pass").value);
		var url= siteURL+"/page_include/inc_ajaxload_changepassword.php";
		url = url+"?ol="+ol+"&ne="+ne+"&cn="+cn;
		xmlHttp_login.onreadystatechange=changepwd_stateTagsChanged();/*function()
										{
											if (xmlHttp_login.readyState == 4 && xmlHttp_login.status == 200)
											{
												var res = xmlHttp_login.responseText;
												if(res == "success")
												{alert(siteURL+'logout.php');
													alert('Your password has been changed successfully');
													//window.location.href = siteURL+'logout.php';
												}
												else
												{
													alert(res);
												}
											}
										}*/
		xmlHttp_login.open("GET",url,true);
		xmlHttp_login.send(null); 
	}
	
	function changepwd_stateTagsChanged() 
	{ 
		if (xmlHttp_login.readyState==4)
		{ 
			var res = xmlHttp_login.responseText;
			
			if(res == "success")
			{
				if(res == "success")
				{
					alert('Your password has been changed successfully');
					//window.location.href = siteURL+'logout.php';
				}
				else
				{
					alert(res);
				}
			}
			else
			{
				//var arr = res.split("##");
				var td_id = 'err_msg';
				//document.getElementById(td_id).innerHTML = '<tr><td width="100%" align="left" colspan="3" class="white_links">'+res+'</td></tr>';
				alert(res);
			}
			
		}
	} // end of stateChanged
	
// ---------------------------------------------------------------------------------------

// ----------- Email to friends ajax js function -------------------------------	

	function GetXmlHttpObject_Email()
	{
		var xmlHttp_email=null;
			try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp_email=new XMLHttpRequest();
			}
			catch (e)
			{
				// Internet Explorer
				try
				{
					xmlHttp_email=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					xmlHttp_email=new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
		return xmlHttp_email;
	} //end of GetXmlHttpObject
	
	function emailFriends(frm,id,flag,siteURL, popupFlag)
	{
		siteURL		= siteURL||null;
		popupFlag   = popupFlag||0;
		
		var url;
		xmlHttp_common_email = GetXmlHttpObject_Email();
		if (xmlHttp_common_email==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var email 	= encodeURIComponent(document.getElementById("txtEmail").value);
		var msg 	= encodeURIComponent(document.getElementById("txtComments").value); 
		
		url= siteURL+"/page_include/inc_ajaxload_common_email_friends.php";
		
		// for parameters	
		/*if(flag == 'Video')
		{
			tmpVal	   = id.split("##");
			id		   = tmpVal[0];
			shareFlag = tmpVal[1];

			url = url+"?email="+email+"&msg="+msg+"&i="+id+"&sFlag="+shareFlag+"&flag="+flag; //Only for Share a Video
		}
		else if(flag == 'Quote')
		{
			url = url+"?email="+email+"&msg="+msg+"&i="+id+"&flag="+flag;	
		}
		else if(flag == 'Carrot')
		{
			url = url+"?email="+email+"&msg="+msg+"&i="+id+"&flag="+flag;	
		}
		else
		{*/
			url = url+"?email="+email+"&msg="+msg+"&i="+id+"&flag="+flag;		
		//}
		xmlHttp_common_email.onreadystatechange = function ()/** new_email_stateChanged(); **/
												  {
													 	if (xmlHttp_common_email.readyState==4 )
														{ 
															var res = xmlHttp_common_email.responseText;			
															var resArr 	= res.split("##");
															if(resArr.length >1)
															{
																var resArr1  = resArr[0];
																var resArr2	= resArr[1];
																
																if(trim(resArr1) == "success")
																{	
																	if(popupFlag == 1)
																		window.parent.location = resArr[1];
																	else
																		window.location.href = resArr[1];
																}
															}
															else
															{
																alert(res); 
															}
															
														}
												  }

		xmlHttp_common_email.open("GET",url,true);
		xmlHttp_common_email.send(null); 
	}
	
	function new_email_stateChanged(popupFlag) 
	{		
		popupFlag	= popupFlag||0;
		if (xmlHttp_common_email.readyState==4 )
		{ 
			var res = xmlHttp_common_email.responseText;			
			
			var resArr 	= res.split("##");
			
			if(resArr.length >1)
			{
				var resArr1  = resArr[0];
				var resArr2	= resArr[1];
				
				if(trim(resArr1) == "success")
				{	
					if(popupFlag == 1)
						window.parent.location = resArr[1];
					else
						window.location.href = resArr[1];
				}
				
			}
			else
			{
				alert(res); 
			}
			
		}
	} // end of news stateChanged
	
	function email_stateChanged() 
	{ 
		
		if (xmlHttp_email.readyState==4)
		{ 
			var res = xmlHttp_email.responseText;
			
			if(res == "success")
			{
				window.location.href = siteURL+'/vote-topics.php';
			}
			else
			{
				//var arr = res.split("##");
				//var td_id = 'err_msg';
				//document.getElementById(td_id).innerHTML = '<tr><td width="100%" align="left" colspan="3" class="white_links">'+res+'</td></tr>';
				alert(res);
			}
			
		}
	} // end of stateChanged
// -----------------------------------------------------------------------------------------


// --------------Comment reply ajax function ------------------------------------------------

	function commentReply()
	{
		xmlHttp_reply = GetXmlHttpObject_Email();
		if (xmlHttp_reply==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var reply = encodeURIComponent(document.getElementById("txtcomment_content").value);
		var i = encodeURIComponent(document.getElementById("i").value);
		var p = encodeURIComponent(document.getElementById("p").value);
		var sec = encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var sec_ref = encodeURIComponent(document.getElementById("security_refid").value);
		
		var url=siteURL+"/page_include/inc_ajaxload_post_comment_reply.php";
		url = url+"?i="+i+"&p="+p+"&reply="+reply+"&sec="+sec+"&sec_ref="+sec_ref;
		xmlHttp_reply.onreadystatechange=commentreply_stateChanged;
		xmlHttp_reply.open("GET",url,true);
		xmlHttp_reply.send(null); 
	}
	
	function commentreply_stateChanged() 
	{ 
		
		if (xmlHttp_reply.readyState==4)
		{ 
			var res = xmlHttp_reply.responseText;
			var arr = res.split("||##||");
			if(arr[0] == 999)
			{
				window.location.href = siteURL+'/vote-topic-details.php?i='+arr[1];
			}
			else
			{//alert(arr[0]+"----**************-----"+arr[1]);
				alert(arr[0]);
			}
			
			/*if(res == "error")
			{
				alert("Please enter reply")
			}
			else
			{
				//var arr = res.split("##");
				window.location.href = siteURL+'/poll-review-details.php?i='+res;
			}*/
			
		}
	} // end of stateChanged
	
// ------------------------------------------------------------------------------------------



// --------------Blog Post Comment ajax function ------------------------------------------------
	function chkAllPostComment(siteURL,flag)
	{
		siteURL	= siteURL||null; // to check if site URL is defined or not
		flag	= flag||1;

		xmlHttp_postcomment = GetXmlHttpObject_Email();
		if (xmlHttp_postcomment==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}

		var id 			= encodeURIComponent(document.getElementById("txtItemRef_id").value);
		var name 		= encodeURIComponent(document.getElementById("txtName").value);
		var email 		= encodeURIComponent(document.getElementById("txtEmail").value);
		var com 		= encodeURIComponent(document.getElementById("txtcomment_desc").value);
		var sec 		= encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var sec_ref 	= encodeURIComponent(document.getElementById("security_refid").value);
		var moduleName  = encodeURIComponent(document.getElementById("moduleName").value);
		var agree 		= encodeURIComponent(document.getElementById("chkis_agree").checked);
		
		
		var url= siteURL+"/page_include/inc_ajaxload_all_post_comment.php";
		url = url+"?id="+id+"&name="+name+"&email="+email+"&com="+com+"&sec="+sec+"&sec_ref="+sec_ref+"&agree="+agree+"&module="+moduleName; 
		//alert('url....'+url);
	
		xmlHttp_postcomment.onreadystatechange=function ()
												{	
													if (xmlHttp_postcomment.readyState == 4 && xmlHttp_postcomment.status == 200)
													{												
														var result 	= xmlHttp_postcomment.responseText;	//alert('result...'+result);													
														var arr 	= result.split("||##||");
														
														if(trim(arr[0]) == "success")
														{
														
															//if(moduleName == 'Politician_Comment')
																//alert("Your comment will be displayed only when admin approves!!");
															if(flag ==1)
															{
																//alert("Thanks for your comment. Your comment will be displayed only when admin approves!!");
																window.parent.location = arr[1];	
															}
															else
																window.location.href = arr[1];
														}
														else if(trim(arr[0]) == "error")
														{
															var err = arr[1];
															alert(err);
														}
													}
												};
		xmlHttp_postcomment.open("GET",url,true);
		xmlHttp_postcomment.send(null); 
	}

	function chkBlogPostComment()
	{
		xmlHttp_postcomment = GetXmlHttpObject_Email();
		if (xmlHttp_postcomment==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var pid = encodeURIComponent(document.getElementById("txtpost_id").value);
		var bid = encodeURIComponent(document.getElementById("txtblog_id").value);
		var com = encodeURIComponent(document.getElementById("txtcomment_desc").value);
		var sec = encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var sec_ref = encodeURIComponent(document.getElementById("security_refid").value);
		
		//var ref_link = document.getElementById("ref_link").value;
		/*var ref = "";
		if(ref_link != "")
			ref = "&ref="+ref_link;*/
		var url= siteURL+"/page_include/inc_ajaxload_blog_post_comment.php";
		url = url+"?pid="+pid+"&bid="+bid+"&com="+com+"&sec="+sec+"&sec_ref="+sec_ref+"&flag=4";
	
		xmlHttp_postcomment.onreadystatechange=postcomment_stateChanged;
		xmlHttp_postcomment.open("GET",url,true);
		xmlHttp_postcomment.send(null); 
	}
	
	function postcomment_stateChanged() 
	{ 
		if (xmlHttp_postcomment.readyState==4)
		{ 
			var res = xmlHttp_postcomment.responseText;
			var arr = res.split("||##||");
			
			if(trim(arr[0]) == "success")
			{
				window.location.href = arr[1];
			}
			else
			{
				var err = arr[1];
				alert(err);
			}
			
		}
	} // end of stateChanged


	function chkPoliticianPostComment()
	{
		xmlHttp_postcomment = GetXmlHttpObject_Email();
		if (xmlHttp_postcomment==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		var pid 	= encodeURIComponent(document.getElementById("txtpid").value);
		var com 	= encodeURIComponent(document.getElementById("txtcomment_desc").value);
		var sec 	= encodeURIComponent(document.getElementById("txtsecuritycode").value);
		var sec_ref = encodeURIComponent(document.getElementById("news_security_refid").value);
		
		var url= siteURL+"/page_include/inc_ajaxload_politician_post_comment.php";
		url = url+"?pid="+pid+"&com="+com+"&sec="+sec+"&sec_ref="+sec_ref;
		xmlHttp_postcomment.onreadystatechange=function ()
												{	
													if (xmlHttp_postcomment.readyState == 4 && xmlHttp_postcomment.status == 200)
													{												
														var result 	= xmlHttp_postcomment.responseText;														
														var arr 	= result.split("||##||");
														
														if(trim(arr[0]) == "success")
														{
															alert("Your comment will be displayed only when admin approves!!");
															window.location.href = arr[1];
														}
														else
														{
															var err = arr[1];
															alert(err);
														}
													}
												};
		xmlHttp_postcomment.open("GET",url,true);
		xmlHttp_postcomment.send(null); 	  
	}
	
	
	function postcomment_videostateChanged() 
	{ 
		if (xmlHttp_postcomment.readyState==4)
		{ 
			var res = xmlHttp_postcomment.responseText;
			var arr = res.split("||##||");
			if(trim(trim(arr[0])) == "success")
			{
				window.location.href = arr[1];
			}
			else if(trim(arr[0]) == "error")
			{
				var err = arr[1];
				alert(err);
			}
			
		}
	} // end of stateChanged

	function displayCatVideos(divId,CatId,siteURL,rowId,cnt)  // To display videos of a category
	{
		var xmlHttp_catVideos = GetXmlHttpObject_Email();
		//alert(CatId);
		
		document.getElementById('LoadingImageId').style.display = "block";
		if (xmlHttp_catVideos==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}	
		
		var url= siteURL+"/inc_get_category_videos.php";
		url = url+"?catId="+CatId;
		
		xmlHttp_catVideos.onreadystatechange = function ()
												{
													if (xmlHttp_catVideos.readyState == 4 && xmlHttp_catVideos.status == 200)
													{
														document.getElementById('LoadingImageId').style.display = "none";
														var res1234 = xmlHttp_catVideos.responseText;
														
														document.getElementById('catVideosId').innerHTML= res1234;
														
														document.getElementById('universal_topic_id_'+rowId).className = 'selectedvideo';
														for(var i=1;i<(cnt+1);i++)
														{
																if(i!=rowId)
																{
																	document.getElementById('universal_topic_id_'+i).className = '';	
																}
														}
													}
												}
		xmlHttp_catVideos.open("GET",url,true);
		xmlHttp_catVideos.send(null); 
	}
	
	
// -------------- End Blog Post Comment ajax function ------------------------------------------------

// -------------- Start Cabinet delete ajax function ------------------------------------------------
function deleteCabinet(id)
{
	var answer = confirm("Do you want to delete this Cabinet? \nIf you delete this cabinet all comments, votes and points earned will be deleted.")
	if (answer)
	{	
		xmlHttp_cabinet = GetXmlHttpObject_Email();
		if (xmlHttp_cabinet==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
				
		var url=siteURL+"/page_include/inc_ajaxload_delete_cabinet.php";
		url = url+"?i="+id;
		xmlHttp_cabinet.onreadystatechange=deleteCabinet_stateChanged;
		xmlHttp_cabinet.open("GET",url,true);
		xmlHttp_cabinet.send(null); 
	}
}
function deleteUserCartoon(id,userId)
{
	var answer = confirm("Do you want to delete this cartoon? \nIf you delete this cartoon all comments, votes will be deleted.")
	if (answer)
	{	
		xmlHttp_cabinet = GetXmlHttpObject_Email();
		if (xmlHttp_cabinet==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
				
		var url=siteURL+"/page_include/inc_ajaxload_delete_cartoon.php";
		url = url+"?i="+id+"&u="+userId;
		xmlHttp_cabinet.onreadystatechange=deleteCartoon_stateChanged;
		xmlHttp_cabinet.open("GET",url,true);
		xmlHttp_cabinet.send(null); 
	}
}
function deleteCartoon_stateChanged() 
{ 	
	if (xmlHttp_cabinet.readyState==4)
	{ 
		var res = xmlHttp_cabinet.responseText;
		
		if(trim(res) == "ok")
		{
			//alert("Your Cabinet is deleted. You can build your cabinet again.");
			window.location.href = siteURL+'/cartoon-contests.php';
		}
		else
		{
			alert("Can not deleted your cartoon");
		}		
	}
} // end of stateChanged
function deleteCabinet_stateChanged() 
{ 	
	if (xmlHttp_cabinet.readyState==4)
	{ 
		var res = xmlHttp_cabinet.responseText;
		
		if(res == "ok")
		{
			//alert("Your Cabinet is deleted. You can build your cabinet again.");
			window.location.href = siteURL+'/build-dream-cabinet.php';
		}
		else
		{
			alert("Can not deleted your dream cabinet");
		}		
	}
} // end of stateChanged
// -------------- End Cabinet delete ajax function ------------------------------------------------

// --------------Language dropdown ajax function ------------------------------------------------

	function hideLanguageList()
	{
		document.getElementById("langresultbox").style.display 			= "none";
		document.getElementById('langresultboxtop').style.display 		= "none";
		document.getElementById('langresultboxmiddle').style.display 	= "none";
		document.getElementById('langresultboxbot').style.display 		= "none";
	}
	
	function languageList()
	{
		document.getElementById("langresultbox").style.display 		= "";
		document.getElementById('langresultboxtop').style.display 	= "";
		document.getElementById('langresultboxmiddle').style.display 	= "";
		document.getElementById('langresultboxbot').style.display 	= "";
		/*xmlHttp_lang = GetXmlHttpObject_Email();
		if (xmlHttp_lang==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
				
		var url=siteURL+"/page_include/inc_ajaxload_lang_list.php";
		//url = url+"?i="+i+"&p="+p+"&reply="+reply;
		xmlHttp_lang.onreadystatechange=language_stateChanged;
		xmlHttp_lang.open("GET",url,true);
		xmlHttp_lang.send(null); */
	}
	
	function language_stateChanged() 
	{ 
		
		if (xmlHttp_lang.readyState==4)
		{ 
			var res = xmlHttp_lang.responseText;
			
			document.getElementById("langresultbox").style.display 		= "";
			document.getElementById('langresultboxtop').style.display 	= "";
			document.getElementById('langresultboxmiddle').style.display 	= "";
			document.getElementById('langresultboxbot').style.display 	= "";
			
			document.getElementById('langresultcontain').innerHTML = res;
		}
	} // end of stateChanged
	
// ------------------------------------------------------------------------------------------

// -- To display State and City drop downs for Registartion --
	function getStateCity(val)
	{ 
		if(val == 100)
		{
			document.getElementById('stateId').style.display = 'block';
			document.getElementById('cityId').style.display = 'block';
		}
		else if(val!=100)
		{
			document.getElementById('stateId').style.display = 'none';
			document.getElementById('cityId').style.display = 'none';	
		}
	}
// -- To display State and City drop downs for Registartion -- Ends Here
// ----- Get CITY list -------
	function getCity( siteURL )
	{
		xmlHttp_City = GetXmlHttpObject_Email();
		if (xmlHttp_City==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
				
		var url=siteURL+"/page_include/inc_ajaxload_city_list.php";
		url = url+"?sid="+document.getElementById('selState').value;
		xmlHttp_City.onreadystatechange= function ()
										{
											if (xmlHttp_City.readyState == 4 && xmlHttp_City.status == 200)
											{
												var resCity = xmlHttp_City.responseText;
												document.getElementById('CITY_ID').innerHTML= resCity;
											}
										};
		xmlHttp_City.open("GET",url,true);
		xmlHttp_City.send(null); 
	}
// ------------------------------------------------------------------------------------------

function allowAlphaNumericValue(e)
{
	//alert(e.charCode+"char------------key"+e.keyCode);
	var unicode=e.charCode? e.charCode : e.keyCode
	//if the key isn't the backspace key (which we should allow)
	//if( unicode == 37 && unicode == 39 && unicode == 8 && unicode == 46)
	//{
	if ( (unicode>=48 && unicode<=57) || (unicode>=97 && unicode<=122) || (unicode>=65 && unicode<=90) ||  unicode == 37 || unicode == 39 || unicode == 8 || unicode == 46) //if not a number
		return true //disable key press
	else
		return false;//}
}

function numbersonly(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode
	
	// 8 = Backspace, 46 = Delete, 37 = Left arrow, 39 = Right arrow, 9 = Tab
	if (unicode!=8 && unicode!=46 && unicode!=37 && unicode!=39 && unicode!=9)
	{
		//if the key isn't the backspace key (which we should allow)
		if (unicode<48||unicode>57) //if not a number
		return false //disable key press
	}
}

function setNewCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getNewCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}


// To get categories for a language in Admin Video Details Page-- Added By Hina
function getCategoriesForLanguage(langId)
{
	xmlHttp_Cat = GetXmlHttpObject_Email();
	if (xmlHttp_Cat==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	//siteURL --  defined in inc_top.php		
	var url=siteURL+"/admin/get_categories_for_language.php";
	str = "lid="+langId;
	
	xmlHttp_Cat.open("POST",url,true); 
	xmlHttp_Cat.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_Cat.setRequestHeader("Content-length", url.length);
	xmlHttp_Cat.setRequestHeader("Connection", "close");
		
	xmlHttp_Cat.onreadystatechange= function ()
									{
										if (xmlHttp_Cat.readyState == 4 && xmlHttp_Cat.status == 200)
										{
											var resCategories = xmlHttp_Cat.responseText;
											document.getElementById('catRow').innerHTML= resCategories;
										}
									};
	xmlHttp_Cat.send(str); 

}

function getResultForQuote(frmName,quoteId)
{
	xmlHttp_Quote = GetXmlHttpObject_Email();
	if (xmlHttp_Quote==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var frm = document.frmQuoteOMeter;
	flag	= 0;
	if(frm.length)
	{	
		for(var i=0;i<frm.length;i++){
			if(frm[i].checked  == true){
				var OptId	= frm[i].value;
				flag 		= 1; 
			}
		}
	}
	if(flag == 0)
	{
		var OptId = '';	
		
	}
	
	var url=siteURL+"/get_result_for_quote.php";
	str = "qId="+quoteId+"&optId="+OptId;
	
	xmlHttp_Quote.open("POST",url,true); 
	xmlHttp_Quote.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_Quote.setRequestHeader("Content-length", url.length);
	xmlHttp_Quote.setRequestHeader("Connection", "close");
		
	xmlHttp_Quote.onreadystatechange= function ()
									{
										if (xmlHttp_Quote.readyState == 4 && xmlHttp_Quote.status == 200)
										{
											var resString 	= xmlHttp_Quote.responseText;
											//alert('resString....'+resString);
											var stringArr	= resString.split('###');
											//if(stringArr.length >1)
											//{
												var divId		= trim(stringArr[0]);
												var content		= trim(stringArr[1]);
												if(divId == 'resultId')
												{
													document.getElementById('errorId').innerHTML= '';
													document.getElementById('questionDiv').style.display = 'none';
												}
												document.getElementById(divId).innerHTML= content;
											//}
										}
									};
	xmlHttp_Quote.send(str); 
}

function getResultForCarrot(frmName,carrotId)
{
	
	xmlHttp_Carrot = GetXmlHttpObject_Email();
	if (xmlHttp_Carrot==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var frm = document.frmCarrotOMeter;
	flag	= 0;
	if(frm.length)
	{	
		for(var i=0;i<frm.length;i++){
			if(frm[i].checked  == true){
				var OptId	= frm[i].value;
				flag 		= 1;
			}
		}
	}
	if(flag == 0)
	{
		var OptId = '';	
		
	}
	
	var url=siteURL+"/get_result_for_carrot.php";
	str = "cId="+carrotId+"&optId="+OptId;
	
	xmlHttp_Carrot.open("POST",url,true); 
	xmlHttp_Carrot.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_Carrot.setRequestHeader("Content-length", url.length);
	xmlHttp_Carrot.setRequestHeader("Connection", "close");
		
	xmlHttp_Carrot.onreadystatechange= function ()
									{
										if (xmlHttp_Carrot.readyState == 4 && xmlHttp_Carrot.status == 200)
										{
											var resString 	= xmlHttp_Carrot.responseText;
											var stringArr	= resString.split('###');
											//if(stringArr.length >1)
											//{
												var divId		= stringArr[0];
												var content		= stringArr[1];
												if(divId == 'resultId')
												{
													document.getElementById('errorId').innerHTML= '';
													document.getElementById('questionDiv').style.display = 'none';
												}
												document.getElementById(divId).innerHTML= content;
											//}
										}
									};
	xmlHttp_Carrot.send(str); 
}
// To calculate the valid points to be entered by a user --- Added By Hina
function checkForPoints(enteredVal,totPoints,id)
{
	var userPoints;
	
	if(isNaN(enteredVal))
	{
		alert('Please enter valid number.');
		document.getElementById('txtOptionVal_'+id).value   = '';
		setTimeout("document.getElementById('txtOptionVal_"+id+"').select();",1);
		
		return false;
	}
	else if(!isNaN(enteredVal))
	{
		if(parseInt(enteredVal) > 0)
		{
			if(parseInt(enteredVal) > parseInt(totPoints))
			{
				alert('Betting points should not be greater than credit points. Please enter valid points.');
			
				document.getElementById('txtOptionVal_'+id).value   = '';
	
				setTimeout("document.getElementById('txtOptionVal_"+id+"').select();",1);
				
				return false;
			}
			else if(parseInt(enteredVal) <= parseInt(totPoints))
			{
				var prePoints	= document.getElementById('enteredPoints').value;

				if(isNaN(prePoints))
				{
					userPoints = parseInt(enteredVal);
				}
				else 
				{
					userPoints	= parseInt(prePoints)+parseInt(enteredVal);
				}
				if(parseInt(userPoints) >  parseInt(totPoints))
				{
					alert('Total Betting Points can not be greater than the credit points. Please enter valid points');	
					return false;
				}
				else
				{
					document.getElementById('enteredPoints').value = parseInt(prePoints) + parseInt(enteredVal);
					return true;
				}
				
				
				
			}//else if(Number(enteredVal) <= Number(totPoints))
			
		}//if(Number(enteredVal) > 0)
		
	}//else if(!isNaN(enteredVal))
}
function getResultForPulse(pulseId)
{
	xmlHttp_Pulse = GetXmlHttpObject_Email();
	if (xmlHttp_Pulse==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var frm = document.frmPulseOMeter;
	flag	= 0;
	if(frm.length)
	{	
		for(var i=0;i<frm.length;i++){
			if(frm[i].checked  == true){
				var OptId	= frm[i].value;
				flag 		= 1;
			}
		}
	}
	if(flag == 0)
	{
		var OptId = '';	
		
	}
	
	var url=siteURL+"/get_result_for_pulse.php";
	str = "pId="+pulseId+"&uoId="+OptId;;
	
	xmlHttp_Pulse.open("POST",url,true); 
	xmlHttp_Pulse.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_Pulse.setRequestHeader("Content-length", url.length);
	xmlHttp_Pulse.setRequestHeader("Connection", "close");
		
	xmlHttp_Pulse.onreadystatechange= function ()
									{
										if (xmlHttp_Pulse.readyState == 4 && xmlHttp_Pulse.status == 200)
										{
											var resString 	= xmlHttp_Pulse.responseText;
											//alert('resString....'+resString);
											var stringArr	= resString.split('###');
											var divId		= trim(stringArr[0]);
											var content		= trim(stringArr[1]);
											if(divId == 'resultId')
											{
												document.getElementById('errorId').innerHTML= '';
												document.getElementById('optionDiv').style.display = 'none';
											}
											document.getElementById(divId).innerHTML= content;											
										}
									};
	xmlHttp_Pulse.send(str); 
}
function getResultForPredict(predictId)
{
	
	xmlHttp_Predict = GetXmlHttpObject_Email();
	if (xmlHttp_Predict==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var frm = document.frmPredictOMeter;
	flag	= 0;
	if(frm.length)
	{	
		for(var i=0;i<frm.length;i++){
			if(frm[i].checked  == true){
				var OptId	= frm[i].value;
				flag 		= 1; 
			}
		}
	}
	if(flag == 0)
	{
		var OptId = '';	
		
	}
	
	var url=siteURL+"/page_include/inc_ajaxload_get_result_predict_meter.php";		
	str = "pId="+predictId+"&uoId="+OptId;;
	
	xmlHttp_Predict.open("POST",url,true); 
	xmlHttp_Predict.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_Predict.setRequestHeader("Content-length", url.length);
	xmlHttp_Predict.setRequestHeader("Connection", "close");
		
	xmlHttp_Predict.onreadystatechange= function ()
									{
										if (xmlHttp_Predict.readyState == 4 && xmlHttp_Predict.status == 200)
										{
											var resString 	= xmlHttp_Predict.responseText;
											//alert('resString....'+resString);
											var stringArr	= resString.split('###');
											var divId		= trim(stringArr[0]);
											var content		= trim(stringArr[1]);
											if(divId == 'resultId')
											{
												document.getElementById('errorId').innerHTML= '';
												document.getElementById('optionDiv').style.display = 'none';
											}
											document.getElementById(divId).innerHTML= content;											
										}
									};
	xmlHttp_Predict.send(str); 
	
	
}
/*function getResultForPredict(frmName,optionArraySize,predictId)
{
	//alert('hellloo');
	xmlHttp_Predict = GetXmlHttpObject_Email();
	
	var optionId ;
	var optionIdArr		= new Array();
	var optTextValArr	= new Array();
	
	
	if (xmlHttp_Predict==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var frm = document.frmPredictOMeter;
	flag	= 0;
	
	for(var i=0;i<optionArraySize;i++)
	{
		var textValue	= document.getElementById('txtOptionVal_'+i).value;
		if(textValue!='')
		{
			// To retrieve the ids and values of textboxes
				optTextValArr.push(textValue);
				
				var optionId    = document.getElementById('txtOptionId_'+i).value;
				optionIdArr.push(optionId);
			// Ends 
			
			flag = 1;
			//return true;
		}
	}//for

	//document.write(optionIdArr);
	
	if (flag==0)
    {
	  alert("Please fillup atleast one textbox");
	  return false;
    }
   
	if(flag == 1)
	{
		var url=siteURL+"/page_include/inc_ajaxload_get_result_predict_meter.php";
		
		str = "pId="+predictId+"&optIdArr="+optionIdArr+"&textValArr="+optTextValArr;

		xmlHttp_Predict.open("POST",url,true); 
		xmlHttp_Predict.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp_Predict.setRequestHeader("Content-length", url.length);
		xmlHttp_Predict.setRequestHeader("Connection", "close");
			
		xmlHttp_Predict.onreadystatechange= function ()
										{
											if (xmlHttp_Predict.readyState == 4 && xmlHttp_Predict.status == 200)
											{
												var resString 	= xmlHttp_Predict.responseText; //alert('resString.....'+resString);
												var stringArr	= resString.split('###');
												//if(stringArr.length >1)
												//{
													var divId		= trim(stringArr[0]);
													var content		= stringArr[1];
													if(divId == 'resultId')
													{
														document.getElementById('errorId').innerHTML= '';
														document.getElementById('displayID').style.display = 'none';
													}
													document.getElementById(divId).innerHTML= content;
												//}
											}
										};
		xmlHttp_Predict.send(str); 
	}//if(flag == 1)
}*/


//..... Function used to report abuse the site content .....
function confirmReportAbuse(mid, mpid, mn)
{
	if(confirm("Do you want to report this as abuse?"))
	{
		xmlHttp_report = GetXmlHttpObject_Email();
		if (xmlHttp_report==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
			
		var url= siteURL+"/page_include/inc_ajaxload_report_abuse.php";
		url = url+"?mid="+mid+"&for="+mn+"&mpid="+mpid;
	
		xmlHttp_report.onreadystatechange = function()
											{
												if (xmlHttp_report.readyState == 4 && xmlHttp_report.status == 200)
												{
													var result = trim(xmlHttp_report.responseText);
													if(trim(result) != "")
													{
														alert(result);
													}
												}
											};
											
		xmlHttp_report.open("GET",url,true);
		xmlHttp_report.send(null); 
	}
} // end confirmReportAbuse(mid, mpid, mn)


//..... Function used to follow the different modules .....
function followMe(item_id, mn)
{
		xmlHttp_report = GetXmlHttpObject_Email();
		if (xmlHttp_report==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
			
		var url= siteURL+"/page_include/inc_ajaxload_follow_me.php";
		url = url+"?item_id="+item_id+"&for="+mn;
	
		xmlHttp_report.onreadystatechange = function()
											{
												if (xmlHttp_report.readyState == 4 && xmlHttp_report.status == 200)
												{
													var result = xmlHttp_report.responseText;
													if(result != "")
													{
														document.getElementById("FOLLOW_ME_ID").innerHTML = result;
													}
												}
											};
											
		xmlHttp_report.open("GET",url,true);
		xmlHttp_report.send(null); 
	
} // end followMe(item_id, mpid, mn

// Function used to update the politician vote in /vote out
function updatePoliticianProfileVote(politicianId, voteOptId, isPolitician)
{
	//alert(pid);alert(optionId);
	xmlHttp_voting = GetXmlHttpObject();
	if (xmlHttp_voting==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	var url	= siteURL+"/page_include/inc_politician_ajaxload_pollvalues.php";
	url 	= url+"?politicianId="+politicianId+"&voteOptId="+voteOptId+"&isPolitician="+isPolitician+"&flag=1";
	
	xmlHttp_voting.onreadystatechange = function ()
										{	
											if (xmlHttp_voting.readyState == 4 && xmlHttp_voting.status == 200)
											{												
												var result = xmlHttp_voting.responseText;												
												if(trim(result) == 'alreadyvoted')
												{
													alert("Sorry, you have already voted !!!");
												}
												else
												{
													document.getElementById('opt_'+voteOptId).innerHTML= result;
													alert("Thank you for voting !!!");												
												}
											}
										};
	xmlHttp_voting.open("GET",url,true);
	xmlHttp_voting.send(null); 
}


function chkComment()
{
	xmlHttp_postcomment = GetXmlHttpObject_Email();
	if (xmlHttp_postcomment==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	var pid = "";
	var bid = encodeURIComponent(document.getElementById("txtpoll_id").value);
	var com = encodeURIComponent(document.getElementById("txtcomment_desc").value);
	var sec = encodeURIComponent(document.getElementById("txtsecuritycode").value);
	var sec_ref = encodeURIComponent(document.getElementById("security_refid").value);
	
	var url= siteURL+"/page_include/inc_ajaxload_blog_post_comment.php";
	url = url+"?pid="+pid+"&bid="+bid+"&com="+com+"&sec="+sec+"&sec_ref="+sec_ref+"&flag=6";

	xmlHttp_postcomment.onreadystatechange = function ()
											{
												if (xmlHttp_postcomment.readyState==4)
												{ 
													var res = xmlHttp_postcomment.responseText;
													var arr = res.split("||##||");
													
													if(trim(arr[0]) == "success")
													{
														window.location.href = arr[1];
													}
													else
													{
														var err = arr[1];
														alert(err);
													}
												}	
											};
	xmlHttp_postcomment.open("GET",url,true);
	xmlHttp_postcomment.send(null); 
} // end chkComment()

function commentsPaging(qStr)
{	
	xmlHttp_paging = GetXmlHttpObject();
	if (xmlHttp_paging==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var url= siteURL+"/page_include/inc_ajaxload_comments_paging.php";
	url = url+"?"+qStr+"&sid="+Math.random();
	xmlHttp_paging.onreadystatechange= function ()
										{	
											if (xmlHttp_paging.readyState == 4 && xmlHttp_paging.status == 200)
											{												
												var result = xmlHttp_paging.responseText;												
												document.getElementById("txtResult").innerHTML = trim(result);
											}
										};;
	xmlHttp_paging.open("GET",url,true);
	xmlHttp_paging.send(null); 

}

// This is used to get the resolution of the screen -- Added By Hina
function writeCookie(pageName) 
{
	 var res			 = window.screen.height;
	 if(res!=1024)
	 {
		 document.getElementById('smallImage').style.display = 'block';
		 document.getElementById('bigImage').style.display   = 'none';
	 }
	 else if(res == 1024)
	 {
		 document.getElementById('bigImage').style.display 	  = 'block';
		 document.getElementById('smallImage').style.display  = 'none';
	 }
}


function viewCategoryTab(id, tabId, totalTabs, module)
{
	xmlHttp_Tab = GetXmlHttpObject_Email();
	if (xmlHttp_Tab==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	for(i=1; i<=totalTabs; i++)
	{													
		if(i==tabId)
			document.getElementById(i).className = "tab1 selectedtab";
		else
			document.getElementById(i).className = "tab1";
	}
	//document.getElementById("innerContent").innerHTML = '<span class="error" style="height:30px;">Loading...</span>';
	var i;
	var url= siteURL+"/page_include/inc_ajaxload_categorywise_list.php";
	url = url+"?id="+id+"&module="+module;
	xmlHttp_Tab.onreadystatechange=function ()
											{	
												if (xmlHttp_Tab.readyState == 4 && xmlHttp_Tab.status == 200)
												{												
													var result 	= xmlHttp_Tab.responseText;	
													//alert(result);
													
													document.getElementById("innerContent").innerHTML = trim(result);
												}
											};
	xmlHttp_Tab.open("GET",url,true);
	xmlHttp_Tab.send(null); 	  
}

//				  
// function CreateBookmarkLink() {
//
// title = "Webpage Title"; 
// <!-- // Blogger - Replace with <$BlogItemTitle$> 
//  // MovableType - Replace with <$MTEntryTitle$>-->
//
// url = "Webpage URL";
// <!-- // Blogger - Replace with <$BlogItemPermalinkURL$> 
//  // MovableType - Replace with <$MTEntryPermalink$>
//  // WordPress - <?php bloginfo('url'); ?>-->
//
//	if (window.sidebar) { // Mozilla Firefox Bookmark
//		window.sidebar.addPanel(title, url,"");
//	} else if( window.external ) { // IE Favorite
//		window.external.AddFavorite( url, title); }
//	else if(window.opera && window.print) { // Opera Hotlist
//		return true; }
// }
//
// if (window.external) {
//  document.write('<a href="javascript:CreateBookmarkLink();">Add to Favorites</a>'); 
//  } else  if (window.sidebar) {
//  document.write('<a href="javascript:CreateBookmarkLink();">Bookmark Page</a>'); 
// } else if (window.opera && window.print) {	
//   document.write('<a href="javascript:CreateBookmarkLink();">Add Bookmark</a>');
// } 

	function emptyValue()
	{
		//alert('sasas');
		document.getElementById('txtComments').innerHTML ='';
	}
	function showNewsmaker(topic_id, refPage)
	{
		//alert(pid);alert(optionId);
		xmlHttp_newsmaker = GetXmlHttpObject();
		if (xmlHttp_newsmaker==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		var url	= siteURL+"/page_include/inc_newsmaker_votein_voteout.php";		
		url 	= url+"?topic_id="+topic_id+"&refPage="+refPage;
		
		xmlHttp_newsmaker.onreadystatechange = function ()
											{	
												if (xmlHttp_newsmaker.readyState == 4 && xmlHttp_newsmaker.status == 200)
												{												
													var result = xmlHttp_newsmaker.responseText;												
													document.getElementById('newsmaker').innerHTML= result;												
												}
											};
		xmlHttp_newsmaker.open("GET",url,true);
		xmlHttp_newsmaker.send(null); 
	}
	//Function used for getting ad banners
	function getBannerData(size_id, divId, currentPage)
	{
		var xmlHttp_email=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttpBanner=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttpBanner=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttpBanner=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		
		var url			= siteURL+"/page_include/inc_right_banner.php";
		var str			= "size_id="+size_id+"&divId="+divId+"&currentPage="+currentPage;
		xmlHttpBanner.open("POST",url,true); 
		xmlHttpBanner.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttpBanner.setRequestHeader("Content-length", url.length);
		xmlHttpBanner.setRequestHeader("Connection", "close");
		
		
		xmlHttpBanner.onreadystatechange= function ()
										{
											if (xmlHttpBanner.readyState == 4 && xmlHttpBanner.status == 200)
											{
												var resString 	= trim(xmlHttpBanner.responseText); //alert('resString.....'+resString);
												document.getElementById(divId).innerHTML = resString;
											}
										};
		xmlHttpBanner.send(str);
     }
	 
	function updateTopicTodayVoting(topic_id, vote_option)
	{
		xmlHttp_topic = GetXmlHttpObject();
		if(xmlHttp_topic == null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		var url = siteURL+"/page_include/inc_ajaxload_topic_today_voting.php?tid="+topic_id+"&opt="+vote_option;

		xmlHttp_topic.onreadystatechange = 	function ()
											{
												if (xmlHttp_topic.readyState == 4 && xmlHttp_topic.status == 200)
												{
													var result = xmlHttp_topic.responseText;
													if(trim(result) == 'alreadyvoted')
													{
														alert("Sorry, you have already voted !!!");
													}
													else
													{
														document.getElementById('opt_'+vote_option).innerHTML= result;
														//document.getElementById(vote_option).innerHTML= result;
														alert("Thank you for voting !!!");												
													}
												}
											};
		xmlHttp_topic.open("GET",url,true);
		xmlHttp_topic.send(null); 
	} // end function updateTopicTodayVoting()