	function show_Mailto(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{	
		clear(txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email);
		
		//	show/hide panel
		document.getElementById(mailto).style.display=document.getElementById(mailto).style.display == "none" ? "block" : "none";
		document.getElementById(feedback).style.display="none";
		//	set hidden variable's value
		if (document.getElementById(mailto).style.display == "none")
			document.getElementById(hd_mailto).value = "display :none";
		else
		{
			document.getElementById(hd_mailto).value = "display :block";
			document.getElementById(txt_to).focus();
		}
		
		document.getElementById(hd_feedback).value = "display :none";
			
	}
	
	function show_feedback(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		clear(txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email);
		
		//	show/hide panel
		document.getElementById(mailto).style.display="none";
		document.getElementById(feedback).style.display=document.getElementById(feedback).style.display == "none" ? "block" : "none";
		
		//	set hidden variable's value
		document.getElementById(hd_mailto).value = "display :none";
		if (document.getElementById(feedback).style.display == "none")
			document.getElementById(hd_feedback).value = "display :none";
		else
		{
			document.getElementById(hd_feedback).value = "display :block";
			document.getElementById(txt_fdb_name).focus();
		}	
		
	}
	
		
	function validate_mailto(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		var txt_mail_to, lbl_to;
		txt_mail_to =document.getElementById(txt_to);
		lbl_mail_to =document.getElementById(lbl_to);
		if ((txt_mail_to.value=="") || (txt_mail_to.value==null))
		{
			lbl_mail_to.innerHTML="Missing";
			document.getElementById(txt_to).focus();
			return false;			
		}
		else if (emailCheck(txt_mail_to.value)==false)
		{
			lbl_mail_to.innerHTML="Invalid";
			document.getElementById(txt_to).focus();
			return false;					
		}
		ShowSending(bttn_send);
		return true;
	}	
	
	function validate_feedback(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		var txt_name, lbl_name, txt_email, lbl_email;
		txt_name =document.getElementById(txt_fdb_name);
		lbl_name =document.getElementById(lbl_fdb_name);
		txt_email = document.getElementById(txt_fdb_email);
		lbl_email = document.getElementById(lbl_fdb_email);
		
		if ((txt_name.value=="") || (txt_name.value==null))
		{
			lbl_name.innerHTML="Missing";
			document.getElementById(txt_fdb_name).focus();
			return false;			
		}
		else if((txt_email.value=="") || (txt_email.value==null)) 
		{
			lbl_email.innerHTML="Missing";
			document.getElementById(txt_fdb_email).focus();
			return false;
		}
		else if(emailCheck(txt_email.value)==false)
		{
			lbl_email.innerHTML="Invalid";
			document.getElementById(txt_fdb_email).focus();
			return false;			
		}
		ShowSending(bttn_fdb);
		return true;
	}	
	
	function closepnl_mailto(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		clear(txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email);
		document.getElementById(mailto).style.display="none";
		document.getElementById(hd_mailto).value = "display :none";
	}
	
	function closepnl_feedback(mailto,feedback,hd_mailto,hd_feedback,txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		clear(txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email);
		document.getElementById(feedback).style.display="none";
		document.getElementById(hd_feedback).value = "display :none";
	}
	
	function clear(txt_to,txt_from,txt_comment,lbl_to,lbl_errormsg_mailto,txt_fdb_name,txt_fdb_email,txt_fdb_comment,lbl_fdb_name,lbl_fdb_email,bttn_fdb,bttn_send)
	{
		document.getElementById(txt_to).value="";
		document.getElementById(txt_from).value="";
		document.getElementById(txt_comment).value="";
		document.getElementById(lbl_to).innerHTML="";
		document.getElementById(lbl_errormsg_mailto).innerHTML="";
		document.getElementById(txt_fdb_name).value="";
		document.getElementById(txt_fdb_email).value="";
		document.getElementById(txt_fdb_comment).value="";
		document.getElementById(lbl_fdb_name).innerHTML="";
		document.getElementById(lbl_fdb_email).innerHTML="";			
	}
	
	
	//validate email address
	function emailCheck (emailStr) 
	{

		/* The following variable tells the rest of the function whether or not
		to verify that the address ends in a two-letter country or well-known
		TLD.  1 means check it, 0 means don't. */

		var checkTLD=1;

		/* The following is the list of known TLDs that an e-mail address must end with. */

		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

		/* The following pattern is used to check if the entered e-mail address
		fits the user@domain format.  It also is used to separate the username
		from the domain. */

		var emailPat=/^(.+)@(.+)$/;

		/* The following string represents the pattern for matching all special
		characters.  We don't want to allow special characters in the address. 
		These characters include ( ) < > @ , ; : \ " . [ ] */

		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

		/* The following string represents the range of characters allowed in a 
		username or domainname.  It really states which chars aren't allowed.*/

		var validChars="\[^\\s" + specialChars + "\]";

		/* The following pattern applies if the "user" is a quoted string (in
		which case, there are no rules about which characters are allowed
		and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
		is a legal e-mail address. */

		var quotedUser="(\"[^\"]*\")";

		/* The following pattern applies for domains that are IP addresses,
		rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
		e-mail address. NOTE: The square brackets are required. */

		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

		/* The following string represents an atom (basically a series of non-special characters.) */

		var atom=validChars + '+';

		/* The following string represents one word in the typical username.
		For example, in john.doe@somewhere.com, john and doe are words.
		Basically, a word is either an atom or quoted string. */

		var word="(" + atom + "|" + quotedUser + ")";

		// The following pattern describes the structure of the user

		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

		/* The following pattern describes the structure of a normal symbolic
		domain, as opposed to ipDomainPat, shown above. */

		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

		/* Finally, let's start trying to figure out if the supplied address is valid. */

		/* Begin with the coarse pattern to simply break up user@domain into
		different pieces that are easy to analyze. */

		var matchArray=emailStr.match(emailPat);

		if (matchArray==null) {

		/* Too many/few @'s or something; basically, this address doesn't
		even fit the general mould of a valid e-mail address. */

		//alert("Email address seems incorrect (check @ and .'s)");
		return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];

		// Start by checking that only basic ASCII characters are in the strings (0-127).

		for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
		//alert("Ths username contains invalid characters.");
		return false;
		}
		}
		for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
		//alert("Ths domain name contains invalid characters.");
		return false;
		}
		}

		// See if "user" is valid 

		if (user.match(userPat)==null) {

		// user is not valid

		//alert("The username doesn't seem to be valid.");
		return false;
		}

		/* if the e-mail address is at an IP address (as opposed to a symbolic
		host name) make sure the IP address is valid. */

		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {

		// this is an IP address

		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		//alert("Destination IP address is invalid!");
		return false;
		}
		}
		return true;
		}

		// Domain is symbolic name.  Check if it's valid.
		 
		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
		//alert("The domain name does not seem to be valid.");
		return false;
		}
		}

		/* domain name seems valid, but now make sure that it ends in a
		known top-level domain (like com, edu, gov) or a two-letter word,
		representing country (uk, nl), and that there's a hostname preceding 
		the domain or country. */

		if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		//alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
		}

		// Make sure there's a host name preceding the domain.

		if (len<2) {
		//alert("This address is missing a hostname!");
		return false;
		}

		// If we've gotten this far, everything's valid!
		return true;
	}

//show sending.................
		var bButtonClicked = false;
		var bFormSubmitted = false;
		
		function ShowSending(ctrl1) {
		var theForm = document.forms[0];
		//ctrl.disabled = true;
		var ctrl;
		ctrl = document.getElementById(ctrl1);
		ctrl.value = ctrl.value + 'ing....';
		
		return true;		
		}
		
function showstar(btn)
{	
var star,cnt,i,img,rank,filename;
	star=btn.id;
	cnt=parseInt(star.substring(star.length-1,star.length));
	rank=document.getElementById("lblrank");
	filename=btn.src;
	filename=filename.substring(filename.lastIndexOf("/")+1,filename.length);
	//alert(document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_hdRank").value);
	if(document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_hdRank").value!="ranked")
	{
		for(i=1;i<=cnt;i++)
		{	
			if(filename!="starranked.gif")
			img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
			img.src="images/star.gif"			
			
		}	
	}
		/*switch(cnt)	
		{
			case 1: { rank.innerHTML="Poor&nbsp;&nbsp;&nbsp;"; break; }
			case 2: { rank.innerHTML="Below Average&nbsp;&nbsp;&nbsp;"; break; }
			case 3: { rank.innerHTML="Average&nbsp;&nbsp;&nbsp;"; break; }
			case 4: { rank.innerHTML="Above Average&nbsp;&nbsp;&nbsp;"; break; }
			case 5: { rank.innerHTML="Excellent&nbsp;&nbsp;&nbsp;"; break; }
		}*/
	//}
}		
//function showdimstar(btn,rank)

function showdimstar(btn)
{
	var img,i,filename;
	if(document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_hdRank").value!="ranked")
	{
		for(i=1;i<=5;i++)
		{	
			img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
			filename=img.src;
			filename=filename.substring(filename.lastIndexOf("/")+1,filename.length);
			if(filename!="starranked.gif")
				img.src="images/stardim.gif"			
				
		}
	}

	//rank=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_hdRank").value;
	/*for(i=1;i<=rank;i++)
	{	
		img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
		img.src="images/starranked.gif"			
	}
	rank=parseInt(rank)+1;
	for(i=rank;i<=5;i++)
	{	
		img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
		img.src="images/stardim.gif"			
	}*/	
	/*var star,cnt,i,img,rank,filename;
	star=btn.id;
	cnt=parseInt(star.substring(star.length-1,star.length));
	rank=document.getElementById("lblrank");
	rank.innerHTML="";
	filename=btn.src;
	filename=filename.substring(filename.lastIndexOf("/")+1,filename.length);
	if(filename!="starranked.gif")
	{
		for (i=1;i<=cnt;i++)
		{	
			img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
			img.src="images/stardim.gif"			
		}	
	}*/
}		

var obj;
function giverank(star)
{
	try
	{
		obj=new AtiveXObject("Msxml2.XMLHTTP");		
	}
	catch(e){}
	try
	{
		obj=new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e){ obj=null; }
	if(obj!=null)
	{
		var rank,content,url,qstr,i,qvalue,cnt,img;
		rank=star.id;
		rank=rank.substring(rank.length-1,rank.length);
		url=window.location.href;
		url=url.substring(url.indexOf("?")+1,url.lenght);
		qstr=url.split("&");
		for(i=1;i<=rank;i++)
		{	//ActPNL
			img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
			img.src="images/starranked.gif";		
		}
		cnt=parseInt(rank)+1;
		for(i=cnt;i<=5;i++)
		{	//ActPNL
			img=document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_s" + i);
			img.src="images/stardim.gif";		
		}
		for (i=0;i<qstr.length;i++)
		{
			qvalue=qstr[i].split("=");
			if (qvalue[0].toUpperCase()=="CONTENT_ID")
			{
				obj.open("GET","javascript_files/ActPnl.aspx?rank=" + rank + "&content_id=" + qvalue[1],false);
				obj.onreadystatechange=ProcessResponse;
				obj.send(null);				
			}
		}		
	}
	return false;
}		

function ProcessResponse()
{
	if(obj.readyState==4)
	{
		if(obj.status==200)
		{
			var result,star,i,img,cnt;
			result=obj.responseText;
			star=parseInt(result.substring(4,result.length));
			result=result.substring(0,4);	
			//alert(result + " " + star);
			if (result=="done")
			{
				document.getElementById("lblranksave").innerHTML="Your Rating&nbsp;:&nbsp;";
				document.getElementById("_ctl0_ContentPlaceHolder1_ActPNL1_hdRank").value="ranked";
				//alert("Rating Saved.");
				for(i=1;i<=star;i++)
				{	//Content Titel
					img=document.getElementById("_ctl0_ContentPlaceHolder1_uc_content_dg_content__ctl3" + i);
					img.src="images/starranked.gif";						
				}
				cnt=parseInt(star)+1;
				for(i=cnt;i<=5;i++)
				{	//Content Title
					img=document.getElementById("_ctl0_ContentPlaceHolder1_uc_content_dg_content__ctl3" + i);
					img.src="images/stardim.gif";						
				}
			}
			else
			{
				document.getElementById("lblranksave").innerHTML="Rating Not Saved&nbsp;&nbsp;&nbsp;";
				//alert("Rating Not Saved, Please try again.");
			}
		}	
		else
		{
			alert("Rating Not Saved, Please try again.");
			//alert("Error retrieving data!" );
		}
	}
}
