// use like onclick="return openwin(this.href)"
function openwin(url) {
  if( window.open(url,'','width=800,height=600,left=0,top=0,scrollbars=yes,location=yes,resizable=yes') ) return false; else return true;
}
 
// hideH2
function hideH2(itemtext,totalitems){
  var ele;
  for (var i = 1; i<=Number(totalitems); i++) 
	  if (ele=document.getElementById(itemtext+i+String("h2"))) ele.style.display="none";
}

// switchCells
function switchCells(currentitem,itemtext,totalitems){
  var ele;
  for (var i = 1; i<=Number(totalitems); i++)
    if ( i != Number(currentitem) ){
      if (ele=document.getElementById(itemtext+i)) ele.style.display='none';
      if (ele=document.getElementById(itemtext+i+'a')) ele.className='';
    } else {
      if (ele=document.getElementById(itemtext+i)) ele.style.display='block';
      if (ele=document.getElementById(itemtext+i+'a')) ele.className='active';
    }
}

// helper functions
var isXHTML;
function createNewEle(ele){
	if(isXHTML) 
		{ return document.createElementNS('http://www.w3.org/1999/xhtml', ele); }
	else 
		{ return document.createElement(ele); };
};	

function statMenu(menuStats,itemtext,desc,tid) {
	isXHTML=/html\:/.test(document.getElementsByTagName('body')[0].nodeName);
	var ele=document.getElementById(itemtext+'1');
	if (!ele) return;
	if (desc) ele.parentNode.insertBefore(createNewEle('h2'),ele).appendChild(document.createTextNode(desc));
	ele.previousSibling.style.display="block";
	var base=ele.parentNode.insertBefore(createNewEle('div'),ele);
	base.className='nav';
	if (tid) base.id=tid;
	for(var i=0; i<menuStats.length; i++) {
		var aEle;
		(aEle=base.appendChild(createNewEle('div')).appendChild(createNewEle('a'))).appendChild(document.createTextNode(menuStats[i]));
		aEle.id=itemtext+(i+1)+'a';
		aEle.href='javascript:switchCells('+(i+1)+',\''+itemtext+'\','+menuStats.length+')';
		aEle.title='Show '+menuStats[i]+' - without page reload';
	};
	hideH2(itemtext,menuStats.length);
	switchCells(1,itemtext,menuStats.length);
}


// article statistics
function initStatMenu() {
  var menuStatsItems=['Hot topics','Latest comments','Latest articles','Most karma','Most viewed'];
  statMenu(menuStatsItems,'articlestats','Statistics',false);
}

// search menu
function initSearchMenu() {
  var menuSearchItems=['Exports','Local search','Google search'];
  statMenu(menuSearchItems,'searchstats',false,'search');
}

// script written by Radek HULAN
// http://hulan.info/

// category tree is initially not hidden
var categoryhidden = false;
// category groups fold
function categoryfold(){
	categoryhidden = true;
	var i=1;
	var ele;
	while (ele=document.getElementById('subcat'+i++)) ele.style.display='none';
}
// category groups fold
function categoryexpand(){
	categoryhidden=false;
	var i=1;
	var ele;
	while (ele=document.getElementById('subcat'+i++)) ele.style.display='block';
}
// category groups toogle
function categorytoogle(){
	if (categoryhidden)
		categoryexpand();
	else
		categoryfold();
}
function categoryswitch(j){
	if (categoryhidden) {
		categoryexpand();
		return;
	}
	var i=1;
	var ele;
	while (ele=document.getElementById('subcat'+i))
		if (i++==j) ele.style.display='block'; else ele.style.display='none';
	categoryhidden=true;
}
// dremgate
function dgflash (){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="140" height="70">');
document.write('  <param name="movie" value="http://p-con.net/dreamgate/dreamgateB?mylink=http://www.dreamgate.gr.jp/aff/af.php?ue=97,4" />');
document.write('	<param name="quality" value="high" />');
document.write('	<embed src="http://p-con.net/dreamgate/dreamgateB?mylink=http://www.dreamgate.gr.jp/aff/af.php?ue=97,4" width="140" height="70" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
document.write('</object>');
}
// web no tubo
function tuboflash (){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="140" height="70">');
document.write('  <param name="movie" value="http://p-con.net/tubo_B02.swf" />');
document.write('	<param name="quality" value="high" />');
document.write('	<embed src="http://p-con.net/tubo_B02.swf" width="140" height="70" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
document.write('</object>');
}

function flashplugin (){
document.write('<a href="http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
document.write('<img alt="Download" src="http://www.p-con.net/image/get_flash_player.gif" width="88" height="31" border="0" /></a>');
}

function contact1(){
var win1=window.open('http://p-con.net/form/contact1.html','newwindow',
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400');
}
