var arrAllProfilePhotos = new Array();
var currentlyViewedPhoto = 0;
function getPhotos(userid) {
	var m = new Ajax.Request("/js/a.php?pic="+userid, { method: 'get', onSuccess: function(transport) {var result= 
transport.responseText;var str = result.split("\n");for(var i=0; i < str.length - 1; i++) {var hebe = str[i].split(";");var imgTemp = "http://www.asklazim.com/uimages/" + hebe[0]; var imgTemp2 = "http://www.asklazim.com/uimages/" + hebe[1];arrAllProfilePhotos.push(new Array(imgTemp, imgTemp2));}
if(arrAllProfilePhotos.length==0)currentlyViewedPhoto=-1;displayOtherProfilePhotos();}});
}

function displayOtherProfilePhotos(){
var ca = document.getElementById("tdOtherProfilePhotos");
var strOut = "<a href=\"javascript:void(0);\" title=\"\" onclick=\"javascript:displayBiggestProfilePhotos();\">Toplam Resim:" + arrAllProfilePhotos.length +"/"+ (currentlyViewedPhoto+1)+"</a>";
ca.innerHTML = strOut;
}
function switchProfilePhotos(pNumber){
        if(pNumber > arrAllProfilePhotos.length - 1){pNumber = 0;}
        else if(pNumber < 0){pNumber = arrAllProfilePhotos.length - 1}

        currentlyViewedPhoto = pNumber;
        displayBiggestProfilePhotos();
        displayOtherProfilePhotos();

        var mainAvatar = document.getElementById("mainAvatar");
        mainAvatar.src = arrAllProfilePhotos[currentlyViewedPhoto][0];
}

function displayBiggestProfilePhotos(){
        var ca = document.getElementById("spBiggestProfilePhotos");

        document.getElementById("spBiggestProfilePhotos").style.top=85;
        document.getElementById("spBiggestProfilePhotos").style.left=300;

        if(arrAllProfilePhotos.length>0){
                if(ca){
                ca.style.display = "";
                ca.innerHTML = "<table border=0 cellspacing=0 cellpadding=0 bgcolor=white width=604 class=tablePinkBorder>"+
        "<tr class=profileTopBg>"+
"<td><a href=javascript:void(0); class=linkBlue onclick=\"switchProfilePhotos(" + (currentlyViewedPhoto - 1) + ");\">" +((arrAllProfilePhotos.length>1)?"<< &#246;nceki":"") + "</a></td>"+
"<td align=center><a href=javascript:void(0); class=linkBlue onclick=\"document.getElementById('spBiggestProfilePhotos').style.display='none';\">Kapat</a></td>"+
"<td align=right><a href=javascript:void(0); class=linkBlue onclick=\"switchProfilePhotos(" + (currentlyViewedPhoto + 1) + ");\">" +((arrAllProfilePhotos.length>1)?"Sonraki >>":"") + "</a></td>"+
"</tr>"+
"<tr>"+
"<td colspan=3 align=center><a href=javascript:void(0); title=\"\" onclick=\"document.getElementById('spBiggestProfilePhotos').style.display='none';\"><img src=http://www.duslersokagi.com/images/transparent.png width=" + arrAllProfilePhotos[currentlyViewedPhoto][1].width + " height=" +arrAllProfilePhotos[currentlyViewedPhoto][1].height + " style='position:absolute;' border=0><img src=" + arrAllProfilePhotos[currentlyViewedPhoto][1]+ " id=profileBiggestPhoto  style=cursor:pointer; border=0></a></td>"+
                "</tr>"+
                "</table>";
		var mainAvatar = document.getElementById("mainAvatar");
		mainAvatar.src = arrAllProfilePhotos[currentlyViewedPhoto][0];
                }
        }
}
