function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function init() {
	if (window.initVote) { initVote(); }
	if (window.initBullets) { initBullets(); }
	if (window.initForm) { initForm(); }
	if (window.initPlayer) { initPlayer(); }
	document.body.onresize = function () {
//		this.style.width = getInitWidth();
	}
}

function mySwap($id1, $id2) {
	var $t1	= document.getElementById($id1).cloneNode(true);
	var $t2	= document.getElementById($id2).cloneNode(true);
	var $p1 = document.getElementById($id1).parentNode;
	var $p2 = document.getElementById($id2).parentNode;
	
	$p1.replaceChild($t2, document.getElementById($id1));
	$p2.replaceChild($t1, document.getElementById($id2));
}
function initBullets() {
	if (document.getElementById("fastlinks")) {
		var $hrefs = document.getElementById("fastlinks").getElementsByTagName("A");
		var $n	= $hrefs.length;
		while ($n--) {
			$hrefs[$n].onmouseover = function () { 
				document.getElementById('i'+this.id).style.display = 'none';
				document.getElementById('o'+this.id).style.display = '';
			}
			$hrefs[$n].onmouseout = function () { 
				document.getElementById('i'+this.id).style.display = '';
				document.getElementById('o'+this.id).style.display = 'none';
			}
		}
	}
	if (document.getElementById("listen")) {
		var $hrefs = document.getElementById("listen").getElementsByTagName("A");
		var $n	= $hrefs.length;
		while ($n--) {
			$hrefs[$n].onmouseover = function () { 
				document.getElementById(this.id+'off').style.display = 'none';
				document.getElementById(this.id+'on').style.display = '';
			}
			$hrefs[$n].onmouseout = function () { 
				document.getElementById(this.id+'off').style.display = '';
				document.getElementById(this.id+'on').style.display = 'none';
			}
		}
	}
}

function advOpen(openUrl, openWidth, openHeight, openSwitch) {
	var srw = screen ? (screen.width-50)    : 750;
    var srh = screen ? (screen.height-36)   : 564;
    var openScroll  	= "0";
	var documentWrite	= "";
	var	openParameters	= "";
    if ((openWidth>srw) || (openHeight>srh)) {
        openScroll  = "1";
        if (openHeight>srh) { openWidth  = openWidth+16; openHeight = srh-50; }
        if (openWidth>srw)  { openHeight = openHeight+16; openWidth = srw-50; }
    }
    
    srw     = (srw - openWidth)/2;
    srh     = (srh - openHeight)/5;
    
  	var UTCstring;
  	Today = new Date();
  	UTCstring = Today.getUTCHours()*Today.getUTCMinutes()*Today.getUTCSeconds();
//	alert(UTCstring);
	
	var openName;
	openName        = "openPopup"+UTCstring;
//	alert(openName);
	
    openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars="+openScroll+",titlebar=1,resizable=0";
//	alert(openParameters);
	
    switch(openSwitch) {
        case "print":   openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0,menubar=1"; break;
        case "scroll":  openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0"; break;
    }
    var openPopup   = open(openUrl, openName, openParameters);
    return false;
}

function doPlay($rec) {
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	
	return advOpen('http://www.novoeradio.lv/index.php?pid=13539&id='+$rec+'', 460, 220);
}