/*
*	$Source: /cvs/sezame/sezame_cda/core/js/cda_util.js,v $ 
*	$Revision: 1.8 $
*	$Author: sburnoud $
*	$Date: 2006/11/16 09:39:59 $
*	$Name: 1.7 $
*	
*	Copyright 2001-2006 Resource Group International Sarl - Geneva. All rights reserved
*/

<!--
function openImageWindow(name) {
	fenster = window.open(name,'','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=0,resizable=1,width=500,height=400,top=200,left=300');	
	fenster.focus();
}
	
function openNewWindow(name) {
	fenster = window.open(name,'Zielfenster','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
}
function printWindow(name) {
	fenster = window.open(name,'Zielfenster','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=550,top=150,left=200');
	fenster.focus();
}
function sendWindow(name) {
	fenster = window.open(name,'Zielfenster','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=500,height=510,top=150,left=200');
	fenster.focus();
}
function newWindow(name, width, height) {
	fenster = window.open(name,'Zielfenster','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+width+',height='+height+',top=150,left=200');
	fenster.focus();
}

function checkSearchParam(form, minRequiredParam, errMsg) {
	searchParamCount = 0;

	for(j=0;j<form.elements.length;j++){
		el = form.elements[j];
		elType = el.type;
		
		if( elType != 'hidden' && elType != 'submit' ){
		
			if(elType == 'checkbox'){
				if(el.checked)searchParamCount++;				
			}else if(elType == 'select-one'){
				value = el.value;
				if(value >= 0 )searchParamCount++;				
			}else if(elType == 'text'){
				value = el.value;				
				if( value.length > 0)searchParamCount++;
			}
		}
	}	
	if(searchParamCount >= minRequiredParam )return true;
	else{
		alert(errMsg);
		return false;
	}
}

//Disable link in print & send window except the open printer links
function disableLink(){
	var aLinks = document.links;
	for(i=0; i<aLinks.length; i++){
		var link = aLinks[i];
		if(link.id != "printLink")link.href = '#';
	}
}	

//some functions for date field check

// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

//-->