
var my_base_url='http://www.ideawala.com';
var my_pligg_base='';


dochref = document.location.href.substr(document.location.href.search('/')+2, 1000);
if(dochref.search('/') == -1){
	$thisurl = document.location.href.substr(0,document.location.href.search('/')+2) + dochref;
} else {
	$thisurl = document.location.href.substr(0,document.location.href.search('/')+2) + dochref.substr(0, dochref.search('/'));
}
$thisurl = $thisurl + '';

var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/

if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
  try {
	xmlhttp = new XMLHttpRequest ();
  }
  catch (e) {
  xmlhttp = false}
}

function myXMLHttpRequest ()
{
  var xmlhttplocal;
  try {
  	xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
  catch (e) {
	try {
	xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
	catch (E) {
	  xmlhttplocal = false;
	}
  }

  if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
	try {
	  var xmlhttplocal = new XMLHttpRequest ();
	}
	catch (e) {
	  var xmlhttplocal = false;
	}
  }
  return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var xvotesString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;


function vote (user, id, htmlid, md5, value)
{
	var coolness = document.getElementById('cool-' + htmlid).value;	
	var ease = document.getElementById('ease-' + htmlid).value;	
	var million = document.getElementById('million-' + htmlid).value;	

  	/* if (document.getElementById('c1-' + htmlid).checked == true)
	 {
		var coolness = document.getElementById('c1-' + htmlid).value;
	 }
	else if (document.getElementById('c2-' + htmlid).checked == true)
	 {
		var coolness = document.getElementById('c2-' + htmlid).value;
	 }
	else if (document.getElementById('c3-' + htmlid).checked == true)
	 {
		var coolness = document.getElementById('c3-' + htmlid).value;
	 }
	else if (document.getElementById('c4-' + htmlid).checked == true)
	 {
		var coolness = document.getElementById('c4-' + htmlid).value;
	 }
	else if (document.getElementById('c5-' + htmlid).checked == true)
	 {
		var coolness = document.getElementById('c5-' + htmlid).value;
	 }



	 if (document.getElementById('e1-' + htmlid).checked == true)
	 {
		var ease = document.getElementById('e1-' + htmlid).value;
	 }
	else if (document.getElementById('e2-' + htmlid).checked == true)
	 {
		var ease = document.getElementById('e2-' + htmlid).value;
	 }
	else if (document.getElementById('e3-' + htmlid).checked == true)
	 {
		var ease = document.getElementById('e3-' + htmlid).value;
	 }
	else if (document.getElementById('e4-' + htmlid).checked == true)
	 {
		var ease = document.getElementById('e4-' + htmlid).value;
	 }
	else if (document.getElementById('e5-' + htmlid).checked == true)
	 {
		var ease = document.getElementById('e5-' + htmlid).value;
	 }





	 if (document.getElementById('m1-' + htmlid).checked == true)
	 {
		var million = document.getElementById('m1-' + htmlid).value;
	 }
	else if (document.getElementById('m2-' + htmlid).checked == true)
	 {
		var million = document.getElementById('m2-' + htmlid).value;
	 }
	else if (document.getElementById('m3-' + htmlid).checked == true)
	 {
		var million = document.getElementById('m3-' + htmlid).value;
	 }
	else if (document.getElementById('m4-' + htmlid).checked == true)
	 {
		var million = document.getElementById('m4-' + htmlid).value;
	 }
	else if (document.getElementById('m5-' + htmlid).checked == true)
	 {
		var million = document.getElementById('m5-' + htmlid).value;
	 }*/


			
//exit;

	//var ease = document.getElementById('ease-' + htmlid).value;
	//var million = document.getElementById('million-' + htmlid).value;
	
	//var status = document.getElementById('r1-' + htmlid).checked;


 if (document.getElementById('r1-' + htmlid).checked == true)
	{
	var votes = document.getElementById('r1-' + htmlid).value;
	}
	else
	{
	var votes = document.getElementById('r2-' + htmlid).value;
	}

//alert(votes);


	if (xmlhttp) {
		url = $thisurl + "/vote.php";

		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value + "&coolness=" + coolness + "&ease=" + ease + "&million=" + million + "&votes=" + votes;;
		
	


		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.ideawala.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
                
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			target1 = document.getElementById ('xvotes-' + htmlid);  
				target4 = document.getElementById ('cool-' + htmlid);  
			
    			//mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
			
				
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;

    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);

								
				
							changemnmvalues (htmlid, value, true);    					} else {
														if (xvotesString[htmlid].substring (1, 6) == "ERROR :  ad as d sad") { alert(xvotesString[htmlid]);  } else {changemnmvalues (htmlid, value, false); }     					}
    				}
    			}
    		}
    	}
	}
}







function vote_learning (user, id, htmlid, md5, value,page)
{
	
	

	var coolness = document.getElementById('vote-' + htmlid).value;	 //Sending learning vote to coolness
	var ease =  0;
	var million = 0;
	var votes = 0;

	if (xmlhttp) {
		url = $thisurl + "/vote.php";

		var mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value + "&coolness=" + coolness + "&ease=" + ease + "&million=" + million + "&votes=" + votes;;

		if(page)
		 {
		r = confirm("Do you wish to rate this blog post?");	
	     }
		 else
		 {
	r = confirm("Do you wish to rate this article?");	
	  	 }

		if(r){

		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.ideawala.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
                
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
    			target1 = document.getElementById ('xvotes-' + htmlid);  
				target4 = document.getElementById ('cool-' + htmlid);  
			
    			//mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
			
					//alert( mnmxmlhttp[htmlid].responseText);
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;

    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);

								
				
							changemnmvalueslearning (htmlid, value, true);    					} else {
														if (xvotesString[htmlid].substring (1, 6) == "ERROR :  ad as d sad") { alert(xvotesString[htmlid]);  } else {changemnmvalueslearning (htmlid, value, false); }     					}
    				}
    			}
    		}
    } }
	}
}





function changemnmvalueslearning (id, value, error)
{
	
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	target1 = document.getElementById ('xvotes-' + id);
	target4 = document.getElementById ('cools-' + id);
	target6 = document.getElementById ('millions-' + id);
	target9 = document.getElementById ('votecount-' + id);
	target17 = document.getElementById ('message-' + id); //Message after Rating idea for 
	if (error) {
		if (value > 0) { target2.innerHTML = "<span></span> "; }
		else if (value < 0) { target2.innerHTML = "<span></span> "; }
		return false;
	}


if (b.length <= 13) {


		target1.innerHTML = "";
		target4.innerHTML= b[6];  //cools

		target10 =document.getElementById ('linksummaryvote-1');
		target10.innerHTML ="<div style=\"height:auto;\"><a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-1').style.display ? '' : 'none';document.getElementById('votesent-1').style.display = replydisplay;\"><img src=\"/templates/yget/images/star_rate_white.jpg\" border=0></a></div>";
		target17.style.display="";	
	
	
	}


	return false;
}























function unvote (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = $thisurl + "/vote.php";
		var mycontent = "unvote=true&id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;
        if (anonymous_vote == false && user == '0') {
            window.location="http://www.ideawala.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");    
				target1 = document.getElementById ('xvotes-' + htmlid);
  				target2 = document.getElementById ('xvote-' + htmlid);    
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
			
    					if (xvotesString[htmlid].match (errormatch)) {
    						 xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
							changemnmvalues (htmlid, value, true);target2.innerHTML = "<span>Vote</span>";						} else {
							if (xvotesString[htmlid].substring (1, 6) == "ERROR") { alert(xvotesString[htmlid]);  } else {target2.innerHTML = "<span>Vote</span>";changemnmvalues (htmlid, value, false); }							
    					}
    				}
    			}
    		}
    	}
	}
}


function cvote (user, id, htmlid, md5, value)
{
	if (xmlhttp) {
		url = $thisurl + "/cvote.php";
		mycontent = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;

        if (anonymous_vote == false && user == '0') {
            window.location="http://www.ideawala.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');    
    			mnmxmlhttp[htmlid].send (mycontent);
    			errormatch = new RegExp ("^ERROR:");
    			target1 = document.getElementById ('cvote-' + htmlid);        
    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			target1.style.backgroundColor = '#FFFFFF';
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
					
    					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (xvotesString[htmlid].match (errormatch)) {
    						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
    						changecvotevalues (htmlid, true);							
    					} else {
							target1 = document.getElementById ('ratebuttons-' + id);
							target1.style.display = "none";
							target2 = document.getElementById ('ratetext-' + id);
							target2.innerHTML = "Thank you for rating this comment.";
							changecvotevalues (htmlid, false);
    					}
    				}
    			}
    		}
    	}
	}
}

function changemnmvalues (id, value, error)
{
	
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	target1 = document.getElementById ('xvotes-' + id);
    //target2 = document.getElementById ('xvote-' + id);
	//target3 = document.getElementById ('xreport-' + id);
	//target4 = document.getElementById ('xnews-' + id);
	target4 = document.getElementById ('cools-' + id);
	target5 = document.getElementById ('eases-' + id);
	target6 = document.getElementById ('millions-' + id);
	target7 = document.getElementById ('linksummaryvote-' + id);
	//target8 = document.getElementById ('votebox-' + id);
	target9 = document.getElementById ('votecount-' + id);
	target10 = document.getElementById ('linkvotecool-' + id);	// linkfor coolness ..
	target15 = document.getElementById ('linkvoteease-' + id);	// linkfor ease ..
	target16 = document.getElementById ('linkvotemillions-' + id);	// linkvotemillion  ..
	target11 = document.getElementById ('like-' + id);
	target12 = document.getElementById ('hate-' + id);
	target13 = document.getElementById ('divimg-' + id);  //display voting images
	target17 = document.getElementById ('message-' + id);  //thanks message after voting
	if (error) {
		if (value > 0) { target2.innerHTML = "<span></span> "; }
		else if (value < 0) { target2.innerHTML = "<span></span> "; }
		return false;
	}



if (b.length <= 13) {

if(b[4] > b[5])
{
str = "<div class='voteimg' style='background:url(/templates/yget/images/positive.GIF) no-repeat center;'>";	
}

else if(b[4] < b[5])
{
str= "<div class='voteimg' style='background:url(/templates/yget/images/negative.gif) no-repeat center;'>";	
}
else
{
str= "<div class='voteimg' style='background:url(/templates/yget/images/equal.gif) no-repeat center;'>";	
}

str = str + "<table width='1' border='0' cellspacing='0' cellpadding='0' height='60px'><tr><td style='padding-top:20px;'><div class='negative' style='background:white; align:right;'>" + b[5]; 


str = str + "</div></td><td style='padding-left:10px;'><div class='total'><p> <font color=#c62100></font></p> </div></td> <td style='padding-left:65px;'><div class='positive' align='left'>" + b[4]; 

str = str + "</div></td> </tr></table></div></a></span>";


strtop="<span  id=\"divimg-1\"><a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-"+id+"').style.display ? '' : 'none';var replydisplay1=document.getElementById('votesent-"+id+"').style.display ? 'none' : '';document.getElementById('votesent-"+id+"').style.display = replydisplay;document.getElementById('voted-"+id+"').style.display=replydisplay1;\">";

str= strtop + str;
//alert(str);




target13.innerHTML =  str;


		target1.innerHTML = b[0];
		target4.innerHTML= b[6];  //cools
		target5.innerHTML= b[7];   //eases
		//target5.innerHTML= b[2];
		target6.innerHTML= b[8]; //Millions
		//target8.innerHTML ="";
		//target9.innerHTML= "<font color=#015064>" + b[0] + "</font>";
      
		if( b[0] >1)
	    {
	   // target10.innerHTML="<font color=#c62100>Votes</a></font>";
		}
		else
		{
		//  target10.innerHTML="<font color=#c62100>Vote</a></font>";
		}
	//	target11.innerHTML = b[4];
	//	target12.innerHTML = b[5];
		 document.getElementById('voted-'+ id).style.display="";		 
		target17.style.display="";	

		target7.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-"+id+"').style.display ? '' : 'none';var replydisplay1=document.getElementById('votesent-"+id+"').style.display ? 'none' : '';document.getElementById('votesent-"+id+"').style.display = replydisplay;document.getElementById('voted-"+id+"').style.display=replydisplay1;\">Pick or Pan?</a>&nbsp;";
	
	

		target10.innerHTML="<a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-"+id+"').style.display ? '' : 'none';var replydisplay1=document.getElementById('votesent-"+id+"').style.display ? 'none' : '';document.getElementById('votesent-"+id+"').style.display = replydisplay;document.getElementById('voted-"+id+"').style.display=replydisplay1;\"><img src=\"http://www.ideawala.com/templates/yget/images/cool.gif\" border= \"0\">Coolness</a>";



		target15.innerHTML="<a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-"+id+"').style.display ? '' : 'none';var replydisplay1=document.getElementById('votesent-"+id+"').style.display ? 'none' : '';document.getElementById('votesent-"+id+"').style.display = replydisplay;document.getElementById('voted-"+id+"').style.display=replydisplay1;\"><img src=\"http://www.ideawala.com/templates/yget/images/flag.gif\" border= \"0\">Ease of Starting</a>";


		target16.innerHTML="<a class=\"blueTxt\" href=\"javascript://\" onclick=\"var replydisplay=document.getElementById('votesent-"+id+"').style.display ? '' : 'none';var replydisplay1=document.getElementById('votesent-"+id+"').style.display ? 'none' : '';document.getElementById('votesent-"+id+"').style.display = replydisplay;document.getElementById('voted-"+id+"').style.display=replydisplay1;\"><img src=\"http://www.ideawala.com/templates/yget/images/dollar.gif\" border= \"0\">Million $ Prospects</a>";

		target17.innerHTML="Thanks for casting your vote to help rank various business ideas.";

		//alert(target15.innerHTML);


		//target1.style.backgroundColor = mnmPrevColor[id];
		 //new Effect.Fade(target3);
		//if (value > 0) { target2.innerHTML = "<span></span> "; }
		//else if (value < 0 ) { target2.innerHTML = "<span></span> ";
		//new Effect.Opacity(target4, {duration:0.8, from:1.0, to:0.3}); }

		//alert("Thanks for participating and voting for business ideas");
		
	}


	return false;
}

function changecvotevalues (id, error)
{
	split = new RegExp ("~--~");
	b = xvotesString[id].split (split);
	target1 = document.getElementById ('cvote-' + id);
	if (error) {
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
	}
	return false;
}


function enablebutton (button, button2, target)
{
	var string = target.value;
	button2.disabled = false;
	if (string.length > 0) {
		button.disabled = false;
	} else {
		button.disabled = true;
	}
}

function checkfield (type, form, field)
{
	url = $thisurl + '/checkfield.php?type='+type+'&name=' + field.value;
	checkitxmlhttp = new myXMLHttpRequest ();
	checkitxmlhttp.open ("GET", url, true);
	checkitxmlhttp.onreadystatechange = function () {
		if (checkitxmlhttp.readyState == 4) {
		responsestring = checkitxmlhttp.responseText;
			if (responsestring == 'OK') {
				document.getElementById (field.name+'checkitvalue').innerHTML = '<span style="color:black">"' + field.value + 
						'": ' + responsestring + '</span>';
				form.submit.disabled = '';
			} else {
				document.getElementById (field.name+'checkitvalue').innerHTML = '<span style="color:red">"' + field.value + '": ' +
				responsestring + '</span>';
				form.submit.disabled = '';
			}
		}
	}
  checkitxmlhttp.send (null);
  return false;
}

function emailto (original_id, htmlid, instpath, address_count)
{
	//alert("fsfds");
	email_message = document.getElementById('email_message' + htmlid).value;
	email_address = document.getElementById('email_address_1_' + htmlid).value;
	if (address_count > 1){ 
		for ($i = 2; $i <= address_count; $i++) {
			if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
				email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
			}
		}
	}
	
	if (xmlhttp) {
		url = $thisurl + "/recommend.php";
		mycontent = "email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Sending, please wait....";
		
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			target1 = document.getElementById ('emailto-' + htmlid);
			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
			
					if (xvotesString[htmlid].match (errormatch)) {
						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];						
					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];
					}
				}
			}
		}
	}
}




function emailtofriend (original_id, htmlid, instpath, address_count)
{
	//alert("fsfds");
	email_message = document.getElementById('email_message' + htmlid).value;
	email_address = document.getElementById('email_address_1_' + htmlid).value;
	if (address_count > 1){ 
		for ($i = 2; $i <= address_count; $i++) {
			if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
				email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
			}
		}
	}
	
	if (xmlhttp) {
		url = $thisurl + "/recommendfriend.php";
		mycontent = "email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Sending mail, please wait....";
		
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			
			mnmxmlhttp[htmlid].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			target1 = document.getElementById ('emailto-' + htmlid);
			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
					result = RemoveLTSpace(xvotesString[htmlid]);
					if(result.indexOf('success') > -1)
						{
						alert("Mail sent successfully");
						window.location="user.php";
						}

					if (xvotesString[htmlid].match (errormatch)) {
						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];	
					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];
						
					}

				



				}
			}
		}
	}
}










function show_recommend(htmlid, linkid, instpath)
{
	var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
	document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;

	if (xmlhttp) {
		url = $thisurl + "/recommend.php";
		mycontent = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";		
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (mycontent);
			errormatch = new RegExp ("^ERROR:");
			target1 = document.getElementById ('emailto-' + htmlid);
			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;			
					if (xvotesString[htmlid].match (errormatch)) {
						xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);						
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];						
					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = xvotesString[htmlid];
					}
				}
			}
		}
	}
}
