

var xmlhttp;


function rateClient(score,client_id)
{

	sURL="http://www.florist-services.com/XMLHTTPfunc.php?function=set_rate_client"+
	"&rate="+score+
	"&client_id="+client_id;

	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		xmlhttp.onreadystatechange=xmlhttpChange
		xmlhttp.open("GET",sURL,true)
		xmlhttp.send(null)
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=xmlhttpChange
			xmlhttp.open("GET",sURL,true)
			xmlhttp.send()
		}
	}
}
 
function xmlhttpChange()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		// if "OK"
		if (xmlhttp.status==200)
		{
			// ...some code here...
		}
		else
		{
			alert("Problem retrieving XML data")
		}
	}
}


function ShowHideConsole(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? '' : 'none';
	el.style.display = display;
}


function resetRate(video_id)
{
	//('handle$id').innerHTML=''

}
function showRate(score,video_id)
{

	if (score>0)
	{
		el = document.getElementById('img1'+video_id);
		el.style.display='';
	}

	if (score>1)
	{
		el = document.getElementById('img2'+video_id);
		el.style.display='';
	}

	if (score>2)
	{
		el = document.getElementById('img3'+video_id);
		el.style.display='';
	}

	if (score>3)
	{
		el = document.getElementById('img4'+video_id);
		el.style.display='';
	}

	if (score>4)
	{
		el = document.getElementById('img5'+video_id);
		el.style.display='';
	}

}

function load_comm_num(client_id)
{
	sURL="http://www.florist-services.com/XMLHTTPfunc.php?function=get_com_num"+
				"&Client_ID="+client_id;
		
		if (window.XMLHttpRequest)
		  {
		  var xmlhttp=new XMLHttpRequest();
		  if (xmlhttp.overrideMimeType) {
               xmlhttp.overrideMimeType('text/xml');
		  }
                

		
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
		  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  }
		  
		xmlhttp.open("POST", sURL, false); 
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader('Content-Type','text/html; charset=iso-8859-1');
		xmlhttp.send(null);
		var RE = /^<success>/;
		if(xmlhttp.responseText.match(RE)) { 
			num=xmlhttp.responseText.replace('<success>','');
			document.getElementById('com_num'+client_id).innerHTML=num;
		}
	else {alert(xmlhttp.responseText);}
	
}
function loadcomments(client_id)
{
	
	sURL="http://www.florist-services.com/XMLHTTPfunc.php?function=load_comments"+
				"&Client_ID="+client_id;
		if (window.XMLHttpRequest)
		  {
		  var xmlhttp=new XMLHttpRequest();
		  if (xmlhttp.overrideMimeType) {
               xmlhttp.overrideMimeType('text/xml');
		  }
                

		
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
		  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  } 
		xmlhttp.open("POST", sURL, false); 
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader('Content-Type','text/html; charset=iso-8859-1');
		xmlhttp.send(null);
		var RE = /^<success>/;
		if(xmlhttp.responseText.match(RE)) { 
			comments=xmlhttp.responseText.replace('<success>','');
			document.getElementById('scom'+client_id).innerHTML=comments;
			document.getElementById('scom'+client_id).style.display='';
		}
		else {alert(xmlhttp.responseText);}
}




function addcomment(client_id)
{
	var nothing='';
	client_text = document.getElementById('d1_text'+client_id).value;
	client_name = document.getElementById('d1_name'+client_id).value;
	
	sURL="http://www.florist-services.com/XMLHTTPfunc.php?function=add_comment"+
	"&Client_Text="+client_text+
	"&Client_Name="+client_name+
	"&Client_ID="+client_id;
	

	if (window.XMLHttpRequest)
		  {
		  var xmlhttp=new XMLHttpRequest();
		  if (xmlhttp.overrideMimeType) {
               xmlhttp.overrideMimeType('text/xml');
		  }
                

		
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
		  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  }
	xmlhttp.open("POST", sURL, false);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader('Content-Type','text/html; charset=iso-8859-1');
	xmlhttp.send(null);
	var RE = /^<success>/;
	
	
	if(xmlhttp.responseText.match(RE)) {
		
		//alert('tag was add !');
		loadcomments(client_id);
		document.getElementById('d1_text'+client_id).value='';
		document.getElementById('d1_name'+client_id).value='';
		document.getElementById('d1'+client_id).style.display='none';
		load_comm_num(client_id);
		
	}
	else {alert(xmlhttp.responseText);}
	

}





function Validate()
{
	var x = document.details.elements
	for (var i=0;i<x.length;i++)
	{
		//				 alert(x[i].name + " = " + x[i].value);
		if (!x[i].value.length) { alert("Please Enter a Search Text.");x[i].focus();return false;}
	}
}

function getPosition(theElement) 
{ 
	var theElement=document.getElementById(theElement);
 var positionX = 0; 
 var positionY = 0; 

 while (theElement != null) 
 { 
   positionX += theElement.offsetLeft; 
   positionY += theElement.offsetTop; 
   theElement = theElement.offsetParent; 
 } 

 positionY=positionY-450;
 if (positionY<0) positionY=100;
 return positionY; 
}

function winOpen(theURL, Name, popW, popH, scroll) {
 var winleft = (screen.width - popW) / 2;
 var winUp = (screen.height - popH) / 2;
 winProp =
'width='+popW+',height='+popH+',left='+winleft+',t op='+winUp+',scrollbars='+scroll+',resizable'
 Win = window.open(theURL, Name, winProp)
 if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}


function formValidation(form){
	
		if(notEmpty(form.comment)){
			return true;
		}
	
	return false;
}

function notEmpty(elem){
	var str = elem.value;
	if(str.length == 0){
		alert("You must fill in a comment");
		elem.comment.focus();
		return false;
	} else {
		return true;
	}

}


function Validate_comment(name)
{
	
	tmp=getElementByid(name);

	alert(tmp);
			//				 alert(x[i].name + " = " + x[i].value);
		//if (!tmp.comment.value.length) { alert("Please Enter a Comment");tmp.comment.focus();return false;}
		
}

function showPopupExt(content,noScrollBar)
{

if (noScrollBar == "1")
{ 
 document.body.scroll = "no";
}
  containerHeight = (document.all) ? document.documentElement.offsetHeight-4 : document.documentElement.scrollHeight;
     bodyHeight = window.document.body.offsetHeight;
     currentHeight = 0;
     
     if (containerHeight < bodyHeight)
     {
     currentHeight = bodyHeight;
     }
     else 
     {
     currentHeight = containerHeight;
     }
     currentHeight = document.documentElement.scrollHeight;// yosi-update
     document.getElementById("blocker").style.height = currentHeight + "px";

 toggleBlocker("show", content); 
}




