function PopUpWin( aUrl, aType ) {
	/*opera.postError('PopUpWin type :'+aType);*/
	var params='';
	switch (aType) {
		case 'normal':
			params='';
			break;
		case 'info':
			params='dependent=yes,menubar=no,location=no,resizable=no,width=500,height=106,toolbar=no,screenX=200,screenY=100';
			break;
		case 'image':
			params='dependent=yes,menubar=no,location=no,resizable=no,width=640,height=480,toolbar=no,screenX=100,screenY=100';
			break;
		case 'media':
			params='dependent=yes,menubar=no,location=no,resizable=no,width=360,height=310,toolbar=no,screenX=100,screenY=100';
			break;
		case 'mini':
			params='dependent=yes,menubar=no,location=no,resizable=no,width=200,height=80,toolbar=no,screenX=100,screenY=100';
			break;
		case 'long':
			params='dependent=yes,menubar=no,location=no,resizable=no,width=600,height=800,toolbar=no,screenX=100,screenY=100,scrollbars=yes';
			break;
		case 'docview':
			params='scrollbars=yes, menubar=yes,toolbar=yes,resizable=yes, width=800,height=800,screenX=100,screenY=100';
			break;
		default: //nic
	}

	/*opera.postError('PopUpWin :'+params);*/
	
	document.transmit=window.open(aUrl,"LinkPopUp", params );
	document.transmit.focus();
	return true;
}

function PopUpWinClose( aUrl, aType ) {
	PopUpWin( aUrl, aType );
	document.transmit.close();
}

function Ask( aTheMsg ) {

	return (window.confirm(aTheMsg));
}

function hyphen2camel (str) {
   return str.replace(/\-(.)/g, function (m, c) {
         return c.toUpperCase();
      }
   );
}

function getStyleValue(el, property){
   var cs, val = false;
   if (window.getComputedStyle) {
      cs  = getComputedStyle(el, null);
      val = cs.getPropertyValue(property);
   }
   else if (el.currentStyle) {
      var xproperty = hyphen2camel(property);
      val = el.currentStyle[xproperty];
   }
   return val;
 }
function SwitchBlock(aImgPrefix, aItem, aImage ) {

	var displaystyle=getStyleValue(aItem, 'display');

	//opera.postError('aItem '+aItem.id+'.style.display='+displaystyle);
	
	if (aItem.style.display=='block' || displaystyle=='block') {
		aItem.style.display='none';
		aImage.src='images/'+aImgPrefix+'unpack.png';
	} else {
		aItem.style.display='block';
		aImage.src='images/'+aImgPrefix+'pack.png';
	}
}

function SwitchAllBlocks(aParentBlockIdnet, aNeeded, aEvoker ) {

	//opera.postError('');

	var block=document.getElementById(aParentBlockIdnet);
	var switchBlockState='block';

	if (typeof document.switchBlockState != "undefined" && document.switchBlockState!=null){
		switchBlockState=document.switchBlockState;
	}
	
	if (typeof block != "undefined" && block!=null){

		// Switch all children
		var child=block.firstChild;
		
		while (child) {
			if (child.nodeType==1 && typeof child.id != 'undefined') {
				if (child.id.indexOf(aNeeded)>0) {
					child.style.display=switchBlockState;
				}
			}
			SwitchChildBlocks(child, aNeeded, switchBlockState);
			child = child.nextSibling;

		}
		
		document.switchBlockState=(switchBlockState=='block'?'none':'block');
	}
	
}

function SwitchChildBlocks(aParentBlock, aNeeded, aState) {
	if (typeof aParentBlock != "undefined" && aParentBlock!=null){

		// Switch all children
		var child=aParentBlock.firstChild;
		while (child) {
			if (child.nodeType==1 && typeof child.id != 'undefined') {
				if (child.id.indexOf(aNeeded)>0) {
					child.style.display=aState;
				}
			}
			SwitchChildBlocks(child, aNeeded, aState);
			child = child.nextSibling;

		}

	}
}
