var img1id;
var img2id;

function setImage(img,id) {
   var u = id == 'loading' ? '/images/loader-blue.gif' : url_full(id);
   if(img == 1) {
      document.getElementById('img1').src = u;
      img1id = id;
   } else if(img == 2) {
      document.getElementById('img2').src = u;
      img2id = id;
   }
}

function url_full(id) {
   var s = trim(id).split(/-/);
   //alert(s);
   return 'http://www.mobilexxx.com/photos/'+s[0]+'/'+s[1]+'.jpg.mobile';
}
function url_thumb(id) {
   var s = trim(id).split(/-/);
   return 'http://www.mobilexxx.com/photos/'+s[0]+'/'+s[1]+'.jpg.75x75';
}

//----------------------
var myCount = 0;
function myCountInc() {
   myCount++;
   showCount();
}
function myCountLoad(p) {
   myCount = p;
   showCount();
}
function showCount() {
   var ele = document.getElementById('yourcnt')
   if(ele) {
      ele.innerHTML = '<b>' + myCount + '</b> Shootouts';
   }
}
//-------------------------

function saveRating(win,lose) {
   var url = '/rpc-saverating.jsp?w=' + win + '&l=' + lose + '&rand=' + new Date().getTime();
   m_curl(url);
}

function changeImage(id,notid) {
   var url = '/rpc-image.jsp?c=1&n=' + img1id +'&n=' + img2id + '&rand=' + new Date().getTime();
   var http = getHTTPObject();
   http.open("GET",url,true);
   http.onreadystatechange = function() {
      if(http.readyState == 4) {
         var s = trim(http.responseText).split(/\n/);
         setImage(id,s);
      }
   }
   http.send(null);
}
function setBothImages() {
   setImage(1,'loading');
   setImage(2,'loading');
   var url = '/rpc-image.jsp?c=2&rand=' + new Date().getTime();
   var http = getHTTPObject();
   http.open("GET",url,true);
   http.onreadystatechange = function() {
      if(http.readyState == 4) {
         var s = trim(http.responseText).split(/\n/);
         setImage(1,trim(s[0]));
         setImage(2,trim(s[1]));
      }
   }
   http.send(null);
}
