function conf()
{
  if( confirm( 'Are you sure?' ) ) return true
  else return false;
}

function openAWindow2( pageToLoad, winName, width, height, center){

xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ) &&(center)){
 xposition = (screen.width - width) / 8;
 yposition = (screen.height - height) / 3;
}

args = "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=1,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only

window.open( pageToLoad, winName, args );

}

function openAWindow( pageToLoad, winName, width, height, center){

xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ) &&(center)){
 xposition = (screen.width - width) / 8;
 yposition = (screen.height - height) / 3;
}

args = "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only

window.open( pageToLoad, winName, args );

}

function void_() {
}

function xget(id) {
	if(document.getElementById) return document.getElementById(id);
	if(document.all) return document.all[id];
	return null;
}

function detect_user_agent(){
	navigator.DOM=!!(document.getElementById?1:0);
	navigator.OPERA=!!(window.opera);
	navigator.OPERA5=!!(navigator.OPERA&&navigator.userAgent.indexOf("pera 5")>0);
	navigator.OPERA6=	!!(navigator.OPERA&&navigator.userAgent.indexOf("pera 6")>0);
	navigator.IE8=		!!(navigator.appVersion.indexOf("IE 8")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE7=		!!(navigator.appVersion.indexOf("IE 7")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE6=		!!(navigator.appVersion.indexOf("IE 6")>0&&!navigator.IE7&&!navigator.IE8&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE5=		!!(navigator.appVersion.indexOf("IE 5")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE4=		!!(document.all&&!navigator.DOM?1:0);
	navigator.IE=		!!(navigator.IE4||navigator.IE5||navigator.IE6);
	navigator.MAC=		!!(navigator.userAgent.indexOf("Mac")>0);
	navigator.NS6=		!!(navigator.DOM && parseInt(navigator.appVersion)>4?1:0);
	navigator.NS4=		!!(document.layers && !navigator.DOM?1:0);
	navigator.DOMCORE1=	!!(typeof(document.getElementsByTagName)!='undefined' && typeof(document.createElement)!='undefined');
	navigator.DOMCORE2=	!!(navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' && typeof(document.createElementNS) != 'undefined');
	navigator.DOMHTML=	!!(navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined');
	navigator.DOMCSS1=	!!(navigator.NS6||navigator.IE)	;
	if(navigator.DOMCORE1&&!navigator.OPERA)
	{	var check_element=document.createElement('p');
		navigator.DOMCSS2=!!(typeof(check_element)=='object');
	} else	navigator.DOMCSS2=!!(false)	
	navigator.DETECTED=	(	navigator.OPERA||navigator.OPERA6||navigator.OPERA5||navigator.IE||navigator.IE6||navigator.IE5||navigator.IE4||navigator.MAC||navigator.NS6||navigator.NS4||navigator.DOM||navigator.DOMHTML||navigator.DOMCORE1||navigator.DOMCORE2||navigator.DOMCSS1||navigator.DOMCSS2	);
	}
		
var current=1;
var currentB=1;
function next(max)
{
	if ((current+5)<=max)
	{
		n=current+5;
		xget('img_'+current).style.display='none';
		xget('img_'+n).style.display='';
		current=current+1;
	}
}
function prev()
{
	if (current>1)
	{
		p=current+5-1;
		n=current-1;
		xget('img_'+p).style.display='none';
		xget('img_'+n).style.display='';
		current=current-1;
	}
}	

function show_video(id)
{
	if (xget('videoblock') && videos.length>=id) xget('videoblock').innerHTML=videos[id];	
	if (xget('videoname') && videos_h1.length>=id) xget('videoname').innerHTML=videos_h1[id];	
	if (xget('link_share') && videos_h1.length>=id && videos_url.length>=id)
	{	
		xget('link_share').setAttribute('addthis:url',videos_url[id]);
		xget('link_share').setAttribute('addthis:title',videos_h1[id]);
	}		
}

function show_div(id) {
	if (xget(id))
	{	
		if (xget(id).style.display=='block' || xget(id).style.display=='')
		{
			xget(id).style.display='none';
			xget(id+'_img').src='images/more.gif';
		}
		else
		{
			xget(id).style.display='block';
			xget(id+'_img').src='images/more_a.gif';
		}
	}
}

function ball() {	
	xget('shakingball').src='images/shaking-ball.gif?r='+Math.random();
}

function getPageSizeMy(){
	var scrollX,scrollY,windowX,windowY,pageX,pageY;
	if (window.innerHeight && window.scrollMaxY) {	
		scrollX = document.body.scrollWidth;
		scrollY = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		scrollX = document.body.scrollWidth;
		scrollY = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		scrollX = document.body.offsetWidth;
		scrollY = document.body.offsetHeight;
	}
	
	if (self.innerHeight) {	// all except Explorer
		windowX = self.innerWidth;
		windowY = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowX = document.documentElement.clientWidth;
		windowY = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowX = document.body.clientWidth;
		windowY = document.body.clientHeight;
	}	
	
	pageY = (scrollY < windowY) ? windowY : scrollY; // for small pages with total height less then height of the viewport
	pageX = (scrollX < windowX) ? windowX : scrollX; // for small pages with total width less then width of the viewport

	return {pageWidth:pageX,pageHeight:pageY,winWidth:windowX,winHeight:windowY};
}
function popuppopup()
{
	var pageSize = getPageSizeMy();

	xget('popuppopup').style.height=pageSize.pageHeight+'px';
	xget('popupdivtable').style.top=(pageSize.pageHeight-500)+'px';
	nextpopup();
	xget('popuppopup').style.display='block';
	xget('popupdivtable').style.display='block';	
	
}
function popupclose()
{
	xget('popuppopup').style.display='none';
	xget('popupdivtable').style.display='none';	
}
function popupclose2()
{
	xget('popuppopup2').style.display='none';
	xget('popupdivtable2').style.display='none';	
}

current_idea=-1
function nextpopup()
{
	idea=Math.floor( Math.random( ) * (ideas.length-1+1) )
	if (current_idea==idea)
	{
		nextpopup()
	}
	else
	{
		current_idea=idea
		xget('popuptd').innerHTML=ideas[idea]		
	}
}

function showwinner(id)
{
	var pageSize = getPageSizeMy();
	xget('popuppopup2').style.height=pageSize.pageHeight+'px';
	xget('popupdivtable2').style.top='100px';
	xget('popuptd2').innerHTML=winners[id];
	xget('popuppopup2').style.display='block';
	xget('popupdivtable2').style.display='block';	
}

