function flip(rid) {
current=(document.getElementById(rid).style.display == 'none') ? 'block' : 'none';
document.getElementById(rid).style.display = current; }
function urimg(url) {
    var vendor = '45';
    var str = 'http://222.lv/urimg/?furl=' + escape(url) + '&vendor=' + vendor;
    var urimg = window.open(str, 'urimg', 'toolbars=no,scrollbars=yes,width=520,height=500,resizable=no');
    return(false); 
}
function checkall() {
  for (i = 0; i < frm.elements.length; i++) {
			if (frm.elements[i].type == 'checkbox') {
				frm.elements[i].checked = true;
			}
		}
}
function popupWindow (URL, w, h, resize)
{
	var day = new Date();
	var id = day.getTime();

	var str = "page" + id + '=window.open("' + URL + '","' + id + '","' +
	  'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,left=20,top=20,' +
      'resizable=' + resize + ',' + 
	  'width=' + w + ',' +
	  'height=' + h + '");';
	
	eval (str);
}
function sc()
	{
	ref=document.referrer;
	if(!ref)return;
	if(ref.length < 7)return;
	ref=ref.toLowerCase();
	ref=ref.substring(7);
	sl=ref.indexOf('/');
	if(sl > 0)ref=ref.substring(0,sl);
	value=0;
	if (ref.indexOf('google.')!=-1)value=2357235;
	if (ref.indexOf('yahoo.')!=-1)value=2565141;
	if (ref.indexOf('msn.')!=-1)value=2565142;
	if (ref.indexOf('ask.')!=-1)value=2571517;
	if (ref.indexOf('altavista.')!=-1)value=2571538;
	if (value==0)return;
	var date = new Date();
	date.setTime(date.getTime()+(30*86400000));
	var exp="; expires="+date.toGMTString();
	}

var x = 0;
var y = 0;

function getPosition(e) {
   e = e || window.event;
   if (e.pageX || e.pageY) {
     x = e.pageX;
     y = e.pageY;
   }
   else {
     x = e.clientX +
       (document.documentElement.scrollLeft ||
       document.body.scrollLeft) -
       document.documentElement.clientLeft;
     y = e.clientY +
       (document.documentElement.scrollTop ||
       document.body.scrollTop) -
       document.documentElement.clientTop;
   }
}
function showhidd(author,description,znak,cifra) {
  if (x > 0) {
    document.getElementById('hidd').style.visibility='';
    if (znak == 0) {
      position = x - cifra;
    } else {
      position = x + cifra - 20;
    }
    document.getElementById('hidd').style.left=position;
    document.getElementById('hidd').style.top=y;
    xxx = 0;
    gaut = author;
    gdesc = description;
    document.getElementById('hidd').innerHTML="<b>"+gaut+"</b><br>"+gdesc;
  } else {
    return false;
  }
}
function hidehidd() {
  document.getElementById('hidd').style.visibility='hidden';
  document.getElementById('hidd').innerHTML="";
}
function showhidd2() {
  if (x > 0) {
    document.getElementById('hidd2').style.visibility='';
    document.getElementById('hidd2').style.left=x+13;
    document.getElementById('hidd2').style.top=y;
  }
}
function hidehidd2() {
  document.getElementById('hidd2').style.visibility='hidden';
}
function ajaxFunction(page,num,type){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
	  if(ajaxRequest.readyState == 4){
		  if (type == 1) {
			  document.getElementById('votediv'+num).innerHTML = ajaxRequest.responseText;
		  } else if (type == 4) {
			  document.getElementById('usersdiv').innerHTML = ajaxRequest.responseText;
		  } else if (type == 5) {
			  document.getElementById('lastblogs').innerHTML = ajaxRequest.responseText;
		  } else if (type == 6) {
			  document.getElementById('lastforum').innerHTML = ajaxRequest.responseText;
		  } else if (type == 7) {
			  document.getElementById('lastphotos').innerHTML = ajaxRequest.responseText;
		  } else if (type == 8) {
			  document.getElementById('randomphoto').innerHTML = ajaxRequest.responseText;
		  } else if (type == 9) {
			  document.getElementById('randomvideo').innerHTML = ajaxRequest.responseText;
		  } else if (type == 10) {
			  document.getElementById('voting').innerHTML = ajaxRequest.responseText;
		  } else if (type == 11) {
			  document.getElementById('randomflash').innerHTML = ajaxRequest.responseText;
		  } else if (type == 12) {
			  document.getElementById('fame').innerHTML = ajaxRequest.responseText;
		  } else {
			  document.getElementById('ajaxDiv1_'+num).innerHTML = ajaxRequest.responseText;
			  document.getElementById('ajaxDiv2_'+num).innerHTML = '';
		  }
	  }
	}
	ajaxRequest.open("GET", page, true);
	ajaxRequest.send(null); 
}
function loadRightModules() {
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=1&myRand="+ myRand;
  ajaxFunction(posturl,0,4);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=2&myRand="+ myRand;
  ajaxFunction(posturl,0,5);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=5&myRand="+ myRand;
  ajaxFunction(posturl,0,8);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=6&myRand="+ myRand;
  ajaxFunction(posturl,0,9);
}
function loadLeftModules() {
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=3&myRand="+ myRand;
  ajaxFunction(posturl,0,6);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=4&myRand="+ myRand;
  ajaxFunction(posturl,0,7);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=7&myRand="+ myRand;
  ajaxFunction(posturl,0,10);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=8&myRand="+ myRand;
  ajaxFunction(posturl,0,11);
  var myRand=parseInt(Math.random()*99999999);
	var posturl="/v2/ajax_stuff.php?type=9&myRand="+ myRand;
  ajaxFunction(posturl,0,12);
}

