
window.addEvent('load', function() 
{
		
	
	var col1 = new MooRainbow('choice_color1', 
	{
		'id': 'mooRainbow1',
		'wheel': true,
				'startColor': [70, 129, 140],
				'onChange': function(color) {
			$('color1').value = color.hex;
			$('color1').setStyle('background-color', color.hex);

		}
	});		
	var col2 = new MooRainbow('choice_color2', 
	{
		'id': 'mooRainbow2',
		'wheel': true,
				'startColor': [70, 129, 140],
				'onChange': function(color) {
			$('color2').value = color.hex;
			$('color2').setStyle('background-color', color.hex);

		}
	});			
	
	var col3 = new MooRainbow('choice_color3', 
	{
		'id': 'mooRainbow3',
		'wheel': true,
				'startColor': [70, 129, 140],
				'onChange': function(color) {
			$('color3').value = color.hex;
			$('color3').setStyle('background-color', color.hex);

		}
	});	

	var col4 = new MooRainbow('choice_color4', 
	{
		'id': 'mooRainbow4',
		'wheel': true,
				'startColor': [70, 129, 140],
				'onChange': function(color) {
			$('color4').value = color.hex;
			$('color4').setStyle('background-color', color.hex);

		}
	});		
	
	
});
function show(what) 
{
	where = document.getElementById(what);
	if (where.style.display=="none" || where.style.display==""){where.style.display="block";where.focus();} 
	else {where.style.display="none";}
}
function show0(what) 
{
	where = document.getElementById(what);
	if (where.style.display=="none" || where.style.display==""){where.style.display="inline";where.focus();} 
}
function inline_00(what0,what00) 
{
	where0 = document.getElementById(what0);
	where00 = document.getElementById(what00);
	if (where0.style.display=='inline'){where00.style.display="inline";document.getElementById('color4selected').value=1;} 
	where0.style.display="inline";	
	document.getElementById('color3selected').value=1;
}
function d_inline_00(what0,what00,what000) 
{
	where0 = document.getElementById(what0);
	where00 = document.getElementById(what00);
	where000 = document.getElementById(what000);
	if (where00.style.display=='inline'){where00.style.display="none";document.getElementById('color4selected').value=0;} 
	else {where0.style.display="none";where000.style.display="none";document.getElementById('color3selected').value=0;}
}
function c_l(what)
{
document.getElementById(what).innerHTML='';
}
function ajaxpostnew (urlpage,w0,h0,mode_0,mode_1,mode_2,color1,color2,color3,color4,color3selected,color4selected,what)
{	
if(window.XMLHttpRequest) http = new XMLHttpRequest();else if(window.ActiveXObject) http = new ActiveXObject("Microsoft.XMLHTTP");else return(false);	 
var url = urlpage;
var params = "w0="+document.getElementById(w0).value+"&h0="+document.getElementById(h0).value
	  +"&mode_0="+document.getElementById(mode_0).value+"&mode_1="+document.getElementById(mode_1).value
	  +"&mode_2="+document.getElementById(mode_2).value+"&color1="+document.getElementById(color1).value
	  +"&color2="+document.getElementById(color2).value+"&color3="+document.getElementById(color3).value
	  +"&color4="+document.getElementById(color4).value+"&color3selected="+document.getElementById(color3selected).value
	  +"&color4selected="+document.getElementById(color4selected).value;
	  if(document.getElementById('w0').value=="") 
	  {
	  alert("Width (Pixels) Empty"); document.getElementById('w0').focus();
	  }
	  else if(document.getElementById('h0').value=="") 
	  {
	  alert("Height (Pixels) Empty"); document.getElementById('h0').focus();
	  }
	  else
	  { 
		document.getElementById('gradinf').innerHTML='';
		http.open("POST", url, true);
		http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http.setRequestHeader("Content-length", params.length);
		http.setRequestHeader("Connection", "close");
		http.onreadystatechange = function() 
			{	
				if(http.readyState==1) {document.getElementById(what).innerHTML="<img src='http://gradcolor.com/img/loader.gif' alt='' border='0' />";}
					 else if(http.readyState==4)
					 {
							   if(http.status==200){document.getElementById(what).innerHTML=http.responseText;}
							   else if(http.status==404){document.getElementById(what).innerHTML = "Url BUG";}
							   else{document.getElementById(what).innerHTML = "Error : ".http.status;}
					 }	
			}
		http.send(params);
	 }
} 
function ajaxget(urlpage,what)
{

	if(document.getElementById('tp00').value=='b')
	{
	
	document.getElementById(what).innerHTML='';
	document.getElementById('tp00').value='a';
	}
	else
	{
	
	if(window.XMLHttpRequest) obj0=new XMLHttpRequest();else if(window.ActiveXObject) obj0=new ActiveXObject("Microsoft.XMLHTTP");else return(false);
        obj0.open ('GET', urlpage, true);
        obj0.onreadystatechange = function() 
        {
         if(obj0.readyState==1) {document.getElementById(what).innerHTML="";}
         else if(obj0.readyState==4)
         {
                   if(obj0.status==200){document.getElementById(what).innerHTML=obj0.responseText;
				   document.getElementById('tp00').value='b';
				   }
                   else if(obj0.status==404){document.getElementById(what).innerHTML = "Url BUG";}
                   else{document.getElementById(what).innerHTML = "Error : ".obj0.status;}
         }
        }
        obj0.send(null);
        return;
	}
} 	
function ajaxget0(urlpage,what)
{
	if(window.XMLHttpRequest) obj1=new XMLHttpRequest();else if(window.ActiveXObject) obj1=new ActiveXObject("Microsoft.XMLHTTP");else return(false);
        obj1.open ('GET', urlpage, true);
        obj1.onreadystatechange = function() 
        {
         if(obj1.readyState==1) {document.getElementById(what).innerHTML="";}
         else if(obj1.readyState==4)
         {
                   if(obj1.status==200){
				   
				   document.getElementById(what).innerHTML=obj1.responseText;
				   
				   document.getElementById('n0_g').innerHTML='';
				   document.getElementById('n1_g').innerHTML='';
				   }
                   else if(obj1.status==404){document.getElementById(what).innerHTML = "Url BUG";}
                   else{document.getElementById(what).innerHTML = "Error : ".obj1.status;}
         }
        }
        obj1.send(null);
        return;
} 	
function displaytext(what) 
{
	thiselement = document.getElementById(what);
	if (thiselement.style.display=="none" || thiselement.style.display==""){thiselement.style.display="inline";thiselement.focus();} 
	else {thiselement.style.display="none";}
}
function dont_displaytext(what) 
{
	thiselement = document.getElementById(what);
	thiselement.style.display="none";
}
  

