var req;
var oldData; 
var doesNotSupport = true;
var value=""; 
 
function getNumber(url, number) 
{ 
    if (oldData == number || !doesNotSupport) 
        return; 
 
    oldData = number; 
	value=number;
    show_comment_form("Se salveaza...");
 
    if (window.XMLHttpRequest) { 
        req = new XMLHttpRequest; 
    } else if (window.ActiveXObject) { 
        req = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
     
    if (req) { 
       req.onreadystatechange = processReqChange; 
	   var temp = url + '?value=' + number + '&PHPSESSID=' + document.photo_comment.sid.value;
	   req.open("GET",temp , true); 
       req.send(null); 
    } else { 
       alert("Your browser does not support XMLHttpRequest technology!"); 
       doesNotSupport = false; 
    } 
}

function processReqChange(){
    // only if req shows "loaded" 
    if (req.readyState == 4) { 
        // only if "OK" 
        if (req.status == 200) { 
            //document.getElementById('result').value = req.responseText; 
			document.photo_comment.comment.value=value;
			if (value!="")
			show_comment_form('<div onclick="show_comment_form(2);"><i><div id="desc_color" onmouseover="change_color();" onmouseout="return_color();">' + value + '</div></i></div>');
			else show_comment_form("");
        } else { 
            alert("There was a problem retrieving the data:\n" + req.statusText);
            //document.getElementById('result').value = req.statusText;
        } 
    } 
}
function show_comment_form(val)
{
if (val==1)
{
 if (document.photo_comment.comment.value=="")
 val='<div onclick="show_comment_form(2);"><i><div id="desc_color" onmouseover="change_color();" onmouseout="return_color();">click aici sa adaugi descrierea profilului...</div></i></div>';
 else
 val='<div onclick="show_comment_form(2);"><i><div id="desc_color" onmouseover="change_color();" onmouseout="return_color();">' + document.photo_comment.comment.value + '</div></i></div>';
 }
else if (val==2)
{ 
var val='<form name="process_image" style="margin:0;">' + '<textarea name="imgcomment" id="mobile" rows="4" style="width:269px;" class="inputdescription1"/>' + document.photo_comment.comment.value + '</textarea>';
val = val + '<br><div align="left"><img name="salveaza" class="buton_salveaza" src="standardimages/1pxtransparent.gif" style="margin-top:5px" onclick="getNumber(\'profile_description.php\', document.process_image.mobile.value);"/>';
val= val + '&nbsp;&nbsp;' + '<img name="renunta" class="buton_renunta" src="standardimages/1pxtransparent.gif" style="margin-top:5px"  onclick="show_comment_form(1);"/></div>' + '</form>'; 
}
if (val=="")
 val='<div onclick="show_comment_form(2);"><i><div id="desc_color" onmouseover="change_color();" onmouseout="return_color();">click aici sa adaugi descrierea profilului...</div></i></div>';
document.getElementById("own_immage_comment").innerHTML=val;
}

var req1;
var oldData1; 
var doesNotSupport1 = true;
var value1="";

function getNumber1(url, number1) 
{ 
	if (oldData1 == number1 || !doesNotSupport1) 
        return; 
 
    oldData1 = number1; 
	value1=number1;
    show_comment_form1("Se salveaza...");
 
    if (window.XMLHttpRequest) { 
        req1 = new XMLHttpRequest; 
    } else if (window.ActiveXObject) { 
        req1 = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
     
    if (req1) { 
       req1.onreadystatechange = processReqChange1; 
	   var temp1 = url + '?value=' + number1 + '&PHPSESSID=' + document.photo_comment1.sid.value;
	   req1.open("GET",temp1 , true); 
       req1.send(null); 
    } else { 
       alert("Your browser does not support XMLHttpRequest technology!"); 
       doesNotSupport1 = false; 
    } 
}

function processReqChange1(){
    // only if req shows "loaded" 
    if (req1.readyState == 4) { 
        // only if "OK" 
        if (req1.status == 200) { 
            //document.getElementById('result').value = req.responseText; 
			document.photo_comment1.comment.value=value1;
			if (value1!="")
			show_comment_form1('<div onclick="show_comment_form1(2);"><div id="desc_color_2" onmouseover="change_color_desc();" onmouseout="return_color_desc();">' + value1 + '</div></div>');
			else show_comment_form1("");
        } else { 
            alert("There was a problem retrieving the data:\n" + req1.statusText);
            //document.getElementById('result').value = req.statusText;
        } 
    } 
}
function show_comment_form1(val)
{
if (val==1)
{
 if (document.photo_comment1.comment.value=="")
 val='<div onclick="show_comment_form1(2);"><i><div id="desc_color_2" onmouseover="change_color_desc();" onmouseout="return_color_desc();">click aici sa adaugi o scurta descriere despre tine...</div></i></div>';
 else
 val='<div onclick="show_comment_form1(2);"><div id="desc_color_2" onmouseover="change_color_desc();" onmouseout="return_color_desc();">' + document.photo_comment1.comment.value + '</div></div>';
 }
else if (val==2)
{ 
var val='<form name="process_image1" style="margin:0;">' + '<textarea name="imgcomment1" id="mobile" rows="4" style="width:406px;" class="inputdescription2"/>' + document.photo_comment1.comment.value + '</textarea>';

val= val + '<br><img name="salveaza" class="buton_salveaza" src="standardimages/1pxtransparent.gif" onclick="getNumber1(\'despre_mine.php\', document.process_image1.mobile.value);" style="margin-top:5px"/>&nbsp;<img name="renunta" class="buton_renunta" src="standardimages/1pxtransparent.gif" onclick="show_comment_form1(1);" style="margin-top:5px"/>' + '</form>';

}
if (val=="")
 val='<div onclick="show_comment_form1(2);"><i><div id="desc_color_2" onmouseover="change_color_desc();" onmouseout="return_color_desc();">click aici sa adaugi o scurta descriere despre tine...</div></i></div>';
document.getElementById("own_immage_comment1").innerHTML=val;
}

function change_color()
{
var div_color=document.getElementById('desc_color');
div_color.style.backgroundColor="#99C1CF";
}
function return_color()
{
var div_color=document.getElementById('desc_color');
div_color.style.backgroundColor="#4D94AC";
}

function change_color_desc()
{
var div_color=document.getElementById('desc_color_2');
div_color.style.backgroundColor="#58A9C3";
}
function return_color_desc()
{
var div_color=document.getElementById('desc_color_2');
div_color.style.backgroundColor="#1085AC";
}
