var Now = new Date;
var RandomX = Now.getTime() % 32768;

function Random( min, max )
{
	RandomX = ( 1103515245 * RandomX + 12345 ) % 32768;

	return Math.floor( RandomX * ( max - min + 1 ) /32768 + min );
}

/// --------------------

var TRACKfrObj;

function TRACKlink(CounterScript) {

	if (!document.createElement)
	{
		return true
	};
	
	var TRACKfrDoc;
  
	if (!TRACKfrObj && document.createElement)
	{
    
		try {
		
			var TRACKfrtemp=document.createElement('iframe');
			TRACKfrtemp.setAttribute('id','TRACKframe');
			TRACKfrtemp.style.border='0px';
			TRACKfrtemp.style.width='0px';
			TRACKfrtemp.style.height='0px';
			TRACKfrObj = document.body.appendChild(TRACKfrtemp);
			if (document.frames) {TRACKfrObj = document.frames['TRACKframe']; }
		}
    
		catch(exception) {
      
			TRACKhf='\<iframe id=" TRACKframe" style="';
			TRACKhf+='border:0px;';
			TRACKhf+='width:0px;';
			TRACKhf+='height:0px;';
			TRACKhf+='"><\/iframe>';
			document.body.innerHTML+= TRACKhf;
			TRACKfrObj = new Object();
			TRACKfrObj.document = new Object();
			TRACKfrObj.document.location = new Object();
			TRACKfrObj.document.location.iframe = document.getElementById('TRACKframe');
			TRACKfrObj.document.location.replace = function(location) { this.iframe.src = location; }
		}
	}
	
	if (navigator.userAgent.indexOf('Gecko') !=-1 && ! TRACKfrObj.contentDocument)
	{
		setTimeout(' TRACKtrack()',10); 
		return false;
	}
	
	// Browser tipo/version NS6
	if (TRACKfrObj.contentDocument) 
	{
		TRACKfrDoc = TRACKfrObj.contentDocument;
	}
  
	// Browser tipo/version IE5.5 & IE6
	else if (TRACKfrObj.contentWindow)
	{
		TRACKfrDoc = TRACKfrObj.contentWindow.document;
	}
	
	// Browser tipo/version IE5
	else if (TRACKfrObj.document)
	{
		TRACKfrDoc = TRACKfrObj.document;
	}
	else 
	{ 
		return true;
	}
  
	TRACKfrDoc.location.replace(CounterScript);
	return false;
}

function writeEmail( email, name )
{
	document.write('<a href=\"mailto:' + unescape(email) + '\">' + unescape(name) + '</a>');
}

function iif( condition, a, b )
{
	if ( condition ) return a; else return b;
}

function disableSelection(target)
{
	if (typeof target.onselectstart!="undefined") //IE
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox
		target.style.MozUserSelect="none"
	else //Opera
		target.onmousedown=function(){return false}

	target.style.cursor = "default"
}

function Popup(url,name,width,height,resize,scroll) {

	var dialogWin = new Object();
	dialogWin.width = width;
	dialogWin.height = height;
	now = new Date();
	var millis=now.getTime();
	var mstr=""+millis;
	if (navigator.appName == "Netscape") {
		dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
		dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
		var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	} else if (document.all) {
		dialogWin.left = (screen.width - dialogWin.width) / 2;
		dialogWin.top = (screen.height - dialogWin.height) / 2;
		var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
	
	window.open(url,name,attr);
}
