//-------------------------------
// NEWWINDOW
//-------------------------------
function NewWindow(mypage,myname,w,h,scroll,pos,resize,menu){			  

	if(pos=="random"){							  		 
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}

	if(pos=="center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		if (TopPosition>30){
			TopPosition=TopPosition-30;
		}
	}
	else if((pos!="center" && pos!="random") || pos==null){
		// LeftPosition=screen.width-w-20;TopPosition=30;
		LeftPosition=20;
		TopPosition=20;
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location='+menu+',directories='+menu+',status='+menu+',menubar='+menu+',toolbar='+menu+',resizable='+resize+'';
	var hdl = window.open(mypage,myname,settings);
	hdl.window.focus();
}

//-------------------------------
// SHOWIMAGE
//-------------------------------
function showImage(key){
	NewWindow('p_photo.php?key='+key,'wnd_photo',487,550,'no','center','no','no')
}

//-------------------------------
// DOPRINT
//-------------------------------
function doPrint(){
   NewWindow('p_print.php','wnd_print',582,430,'yes','center','no','no');
}

//-------------------------------
// DOZOOM
//-------------------------------
function doZoom(){
   NewWindow('p_popup_dove.php','wnd_zoom',616,430,'yes','center','no','no');
}

//-------------------------------
// DOLOGIN
//-------------------------------
function doLoginWnd(str){
   NewWindow('p_login.php?goto='+str,'wnd_login',349,249,'no','center','no','no');
}


//-------------------------------
// FINDPOSX
//-------------------------------
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

//-------------------------------
// FINDPOSY
//-------------------------------
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

//-------------------------------
// GETPOSX
//-------------------------------
function getPosX(id)
{
	var el = document.getElementById(id);	
	return findPosX(el);
}

//-------------------------------
// GETPOSY
//-------------------------------
function getPosY(id)
{
	var el = document.getElementById(id);	
	return findPosY(el);
}

//-------------------------------
// TOGGLEBOX
//-------------------------------
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
	if(document.getElementById)	  //gecko(NN6) + IE 5+
	{
		var obj = document.getElementById(szDivID);
		if (obj!=null){
			obj.style.display = iState ? "block" : "none";
		}		
	}	
}

function toggleDetail(id, iState) 
{        
	body=document.getElementById(id);          
	if (body) {          
		if (iState == 1) {            
			try {              
				body.style.display='table-row';            
			} catch(e) {              
				body.style.display = 'block';            
			}          
		}  else {            
			body.style.display = 'none';
		}
	}

}

//-------------------------------
// GETCHILDS
//-------------------------------
function getChilds(el){
    var kids = el.childNodes;   // Get the list of children
    var numkids = kids.length;  // Figure out how many children there are
    for(var i = numkids-1; i >= 0; i--) {  // Loop backward through the children
        
    }
}


//-------------------------------
// IsNumeric
//-------------------------------

function IsNumeric(sText)
	{
	   var ValidChars = "0123456789";
	   var IsNumber=true;
	   var Char;

	   if (sText=='') IsNumber=false;
	 
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
		  { 
		  Char = sText.charAt(i); 
		  if (ValidChars.indexOf(Char) == -1) 
			 {
			 IsNumber = false;
			 }
		  }
	   return IsNumber;
	   
	   }


//-------------------------------
// formatCurrency
//-------------------------------

<!-- Original:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://www7.ewebcity.com/cyanide7 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function formatCurrency(num) {
if(isNaN(num)) num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+'.'+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '&euro; ' + num + ',' + cents);
}

function formatCurrency_2(num) {
	if(isNaN(num)) num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + '.' + cents);
}
//  End -->


//-------------------------------
// FlashOk
//-------------------------------
function FlashOk(filename,w,h,transparent)
{
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'" id="swf/main" >\n');
    document.write('<param name="movie" value="'+filename+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	if (transparent)
	{
	document.write('<param name="wmode" value="transparent">\n');
	str_transparent='wmode="transparent"';
	}else{
	str_transparent='';
	}
	document.write('  <embed src="'+filename+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+w+'" height="'+h+'" '+str_transparent+' ></embed>\n');
	  
    document.write('</object>\n');
}
