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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}

// RATING PROGRAMS
function prog__rate(pid, rating)
{
	var ax = new Ajax("/dyn-prograte.php", { data: 'p='+pid+'&r='+rating, evalScripts: true, update: $("rater__fb"), method: 'post' });
	ax.request();
}

// RATING PROGRAMS
function news__rate(pid, rating)
{
	var ax = new Ajax("/dyn-newsrate.php", { data: 'n='+pid+'&r='+rating, evalScripts: true, update: $("rater__fb"), method: 'post' });
	ax.request();
}

// RSS ICON EFFECTS
function rss_lighten(obj)
{
	obj.src = '/base_img/rss_on.gif';
}
function rss_darken(obj, icon)
{
	obj.src = '/base_img/rss_'+icon+'.gif';
}

// NEWS SPOT SWITCHING
function news__spot_next(x)
{
	$("___spoth2_"+news__spot_crt).style.display = 'none';
	$("___spota_"+news__spot_crt).style.display = 'none';

	news__spot_crt++;
	if(news__spot_crt > x) news__spot_crt = 1;
	$("__spot_idx").setText(news__spot_crt);

	$("___spoth2_"+news__spot_crt).style.display = 'block';
	$("___spota_"+news__spot_crt).style.display = 'block';
}
function news__spot_prev(x)
{
	$("___spoth2_"+news__spot_crt).style.display = 'none';
	$("___spota_"+news__spot_crt).style.display = 'none';

	news__spot_crt--;
	if(news__spot_crt < 1) news__spot_crt = x;
	$("__spot_idx").setText(news__spot_crt);

	$("___spoth2_"+news__spot_crt).style.display = 'block';
	$("___spota_"+news__spot_crt).style.display = 'block';
}

// BOOKMARKING 
function bookmark_msg(){
	var isie = 0;

	if(document.all) isie = 1;

	if(isie == 1)
	{
		window.external.AddFavorite(location.href, document.title); 
		return false;
	}
	else
	{
		alert("Your web-browser does not support automatic addition of favourites/bookmarks.\n\n"+
				"You will have to use a key-combination or menu option specific to your browser:\n"+
				"  - in Mozilla/Mozilla Firefox try: Ctrl-D\n"+
				"  - in Opera try Ctrl-T\n"+
				"  - for other browsers consult the program's help system/documentation\n\n\n"+
				"NOTE: The key combinations above will bookmark the page you were browsing at that moment.");

		return false;
	}
}

// QUICK SEARCH FORM VALIDATE
function qsearch_validate(src_field)
{
	if((src_field.value != undefined) && (src_field.value != "") && (src_field.value != "Keyword")) return true;
	else return false;
}

// COPY TO CLIPBOARD
function copy__clip(inElement)
{
	var flashcopier = 'flashcopier';
	if(!document.getElementById(flashcopier))
	{
		var divholder = document.createElement('div');
		divholder.id = flashcopier;
		document.body.appendChild(divholder);
	}
	
	document.getElementById(flashcopier).innerHTML = '';
	var divinfo = '<embed src="http://www.softpedia.com/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	document.getElementById(flashcopier).innerHTML = divinfo;
}

