function disableEnterKey(e)
{
     var key;      
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox      

     return (key != 13);
}

function EmailPage(){
        var url = location.href;
        window.open("mailto:EnterEmailHere?subject="+url);
    }
    
    function findPos(obj) {
	        var curleft = curtop = 0;
	        if (obj.offsetParent) {
		        curleft = obj.offsetLeft
		        curtop = obj.offsetTop
		        
		        while (obj = obj.offsetParent) {
			        curleft += obj.offsetLeft
			        curtop += obj.offsetTop
		        }

	        }

	        return [curleft,curtop];
        }

		
	function chooseColor(hex,colorname) {
	
	    document.aspnetForm.SelectedColor.value=hex;
		var newColor = new Image(71,55);
		newColor.src = "./picbutton.asp?clr=";
		newColor.src += hex;

		if(colorname!="")
			document.getElementById('color').innerHTML=colorname;
			document.getElementById('currentColor').src = newColor.src;
		return false;
	}
	
	function ChooseColor2(hex){
	    document.getElementById("selectedColorImage").src = "/images/swatch/" + hex + ".gif";
	    document.getElementById("SelectedColor").value = hex;
	}
	
	function stat(name) {
		window.status = name;
		return true;
	}
	function makeargs( url ) {
		url += '?img=' + document.aspnetForm.workingImage.value + ".gif";
		url += '&ops=' + 1;
		top.location.href = url;
	}
	function verifyColor() {
		if (parent.pictureFrame.document.pictureForm) {
			clr = parent.pictureFrame.document.pictureForm.clr.value;
			chooseColor( clr, 'White' );
		}
	}
	function fillcolorin(e) {
	    //if (!browserok) return true;
	    var x, y;
	    var b = document.getElementById("pictureToColor");
	    var pos = new Array();
	    pos = findPos(b);
	    
	    if (e.offsetX) {
	        x = e.offsetX;
		    y = e.offsetY;
		    
	    } else if (e.layerX) {
	        x = e.pageX - pos[0];
		    y = e.pageY - pos[1];
	    } else { 
		    return true;
	    }
	    ajaxFunction(x,y);
	    return false;
    }
    
    function ajaxFunction(x,y)
    {
    var xmlHttp;
    try
    {  // Firefox, Opera 8.0+, Safari  
	    xmlHttp=new XMLHttpRequest();  
    }
    catch (e)
    {  // Internet Explorer  
	    try
        {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
        }
        catch (e)
        {    try
            {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
            }
            catch (e)
            {      alert("Your browser does not support AJAX!");      
                    return false;      
            }    
        }  
    }
  xmlHttp.onreadystatechange=function()
    {
    var curentDT = new Date()
    if(xmlHttp.readyState==4)
      {
      document.getElementById("canvasimg").src = document.getElementById("canvasimg").src + '#' + curentDT;
      }
    }
  xmlHttp.open("GET","/FillTheImage.aspx?img=" + document.aspnetForm.workingImage.value + "&color=" + document.aspnetForm.SelectedColor.value +"&x=" + x + "&y=" + y,true);
  xmlHttp.send(null);
  
  }
  function SubmitForm(control, theForm){
        if(control.value==-1){
            alert("Please select the category");
            control.focus();
            return;
        }
        theForm.submit();
    }
    
    function removeText(data, str)
{
	if(data.value == str) data.value = '';
}

function showdata(data, str)
{
	if(data.value == '') data.value = str;
}