
	  $(document).ready(function(){

	    populateElement('#url', 'Enter your website url');
		populateElement('#brand', 'Enter your brand name');

	});
    

function populateElement(selector, defvalue) {
    if($.trim($(selector).val()) == "") {
        $(selector).val(defvalue);
    }
  
    $(selector).focus(function() {
        if($(selector).val() == defvalue) {
            $(selector).val("");
        }
    });
    
    $(selector).blur(function() {
        if($.trim($(selector).val()) == "") {
            $(selector).val(defvalue);
        }
    });
 }

function getHTTPObject(){ 
	var xmlhttp; 
	if(window.XMLHttpRequest){ 
    	xmlhttp = new XMLHttpRequest(); 
	}else if (window.ActiveXObject){ 
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
	  	if (!xmlhttp){ 	
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
		} 
  } 
  return xmlhttp; 
}
// JavaScript Document

function key_code(event)
	{
		
		if(event.keyCode==13)
		{
			checkActivitySearch();
		}
	}

dellc_http='';
tech_http='';
digg_http='';
stumb_http='';
reddi_http='';
wiki_http='';
google_http='';
you_http='';
flickr_http='';

function getActivity(urlVal,newpath)
{

 

dellc_http=getHTTPObject();
tech_http=getHTTPObject();
digg_http=getHTTPObject();

stumb_http=getHTTPObject();
reddi_http=getHTTPObject();
wiki_http=getHTTPObject();
google_http=getHTTPObject();
you_http=getHTTPObject();
flickr_http=getHTTPObject();
twitter_http=getHTTPObject();

urlValue=urlVal;
brandName=''

if(urlValue=="" || urlValue=="Enter your website url")
	{
	  alert('Please enter website url');
	  return false
	}




document.getElementById('dellcious').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('technorati').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('digg').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('stumbleupon').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('reddit').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('wikipedia').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('flickr').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';
document.getElementById('twitter').innerHTML='Loading..<img src="images/gathering_status.gif" alt="" />';

var params = "searchurl="+urlValue+"&brand="+brandName+"&check=1";

	social_urls=newpath+"/dellcious_socialactivity.php?"+params;
	
	

     dellc_http.open("GET",social_urls,true);
	 dellc_http.onreadystatechange=dellci_result;
       dellc_http.send(null);

   social_urls=newpath+"/technorati_socialactivity.php?"+params;

	tech_http.open("GET",social_urls,true);
	tech_http.onreadystatechange=tech_result;
    tech_http.send(null);

  social_urls=newpath+"/digg_socialactivity.php?"+params;

   digg_http.open("GET",social_urls,true);
   digg_http.onreadystatechange=digg_result;
   digg_http.send(null);

    social_urls=newpath+"/stumbl_socialactivity.php?"+params;

   stumb_http.open("GET",social_urls,true);
   stumb_http.onreadystatechange=stumbl_result;
   stumb_http.send(null);

   social_urls=newpath+"/reddit_socialactivity.php?"+params;

   reddi_http.open("GET",social_urls,true);
   reddi_http.onreadystatechange=reddit_result;
   reddi_http.send(null);

    social_urls=newpath+"/wiki_socialactivity.php?"+params;

   wiki_http.open("GET",social_urls,true);
   wiki_http.onreadystatechange=wiki_result;
   wiki_http.send(null);

 
   social_urls=newpath+"/flickr_socialactivity.php?"+params;
  
  
   flickr_http.open("GET",social_urls,true);
   flickr_http.onreadystatechange=flickr_result;
   flickr_http.send(null);

   social_urls=newpath+"/twitter_socialactivity.php?"+params;

   twitter_http.open("GET",social_urls,true);
   twitter_http.onreadystatechange=twitter_result;
   twitter_http.send(null);

}
total=0;
function dellci_result()
{
	
	if (dellc_http.readyState==4)
	{ 
		var output=dellc_http.responseText;
		
		total+=parseInt(output);
	    document.getElementById('dellcious').innerHTML= output;
		getTotal();
	}
}
function tech_result()
{
	
	if (tech_http.readyState==4)
	{ 
		var output=tech_http.responseText;
		
		total+=parseInt(output);
	    document.getElementById('technorati').innerHTML= output;
		getTotal();
	}
}
function digg_result()
{
	
	if (digg_http.readyState==4)
	{ 
		var output=digg_http.responseText;
		total+=parseInt(output);
	    document.getElementById('digg').innerHTML= output;
		getTotal();
	}
	
}
function stumbl_result()
{
	
	if (stumb_http.readyState==4)
	{ 
		var output=stumb_http.responseText;
		total+=parseInt(output);
	    document.getElementById('stumbleupon').innerHTML= output;
		getTotal();
	}
	
}
function reddit_result()
{
	
	if (reddi_http.readyState==4)
	{ 
		var output=reddi_http.responseText;
		total+=parseInt(output);
	    document.getElementById('reddit').innerHTML= output;
		getTotal();
	}
	
}
function wiki_result()
{
	
	if (wiki_http.readyState==4)
	{ 
		var output=wiki_http.responseText;
		total+=parseInt(output);
	    document.getElementById('wikipedia').innerHTML= output;
		getTotal();
	}
	
}
/*function google_result()
{
	
	if (google_http.readyState==4)
	{ 
		var output=google_http.responseText;
	    document.getElementById('google_group').innerHTML= output;
	}
	
}
function you_result()
{
	
	if (you_http.readyState==4)
	{ 
		var output=you_http.responseText;
		total+=output;
	    document.getElementById('youtube').innerHTML= output;
	}
	
}*/
function flickr_result()
{
	
	if (flickr_http.readyState==4)
	{ 
		var output=flickr_http.responseText;
		total+=parseInt(output);
	    document.getElementById('flickr').innerHTML= output;
		getTotal();
		
	}
	
}
function twitter_result()
{
	
	if (twitter_http.readyState==4)
	{ 
		var output=twitter_http.responseText;
		total+=parseInt(output);
	    document.getElementById('twitter').innerHTML= output;
		getTotal();
	}
	
}
function getTotal()
{
	
    document.getElementById('totalPopularity').innerHTML=total+" <a href=# class=rep-green-link onMouseOver=show('social-popularity'); onMouseOut=hide('social-popularity');>?</a>";
}

