function showhide(block, iconid, size)
{
	if (document.getElementById(block).style.display == 'block') {
		document.getElementById(block).style.display = 'none';
		document.getElementById(iconid).src = 'skin_common/icons/'+size+'/div_expand.png';
	} else {
		document.getElementById(block).style.display = 'block';
		document.getElementById(iconid).src = 'skin_common/icons/'+size+'/div_collapse.png';
	}
}

function showhidethead(block, iconid)
{
	if (document.getElementById(block).style.display == 'block') {
		document.getElementById(block).style.display = 'none';
		document.getElementById(iconid).src = 'skin_common/icons/16/div_expand.png';
		document.getElementById(block+'_footer').style.display = 'block';
	} else {
		document.getElementById(block).style.display = 'block';
		document.getElementById(iconid).src = 'skin_common/icons/16/div_collapse.png';
		document.getElementById(block+'_footer').style.display = 'none';
	}
}

function switchvalue(IdHiddenBoolValueSwitch)
{
	if (document.getElementById(IdHiddenBoolValueSwitch).value == 'false') {
		document.getElementById(IdHiddenBoolValueSwitch).value = 'true';
	} else {
		document.getElementById(IdHiddenBoolValueSwitch).value = 'false';
	}
}


function switchblock(blocktohide, blocktoshow, iconid, imgblock1, imgblock2)
{
	if (document.getElementById(blocktohide).style.display == 'block') {
		document.getElementById(blocktohide).style.display = 'none';
		document.getElementById(blocktoshow).style.display = 'block';
		document.getElementById(iconid).src = imgblock1;
	} else {
		document.getElementById(blocktohide).style.display = 'block';
		document.getElementById(blocktoshow).style.display = 'none';
		document.getElementById(iconid).src = imgblock2;
	}
}

function confirmer(texte)
{
	if (!confirm(texte)) {
		return false;
	} else {	
		return true;
	}
}

function windowpopup(Href,WidthPx,HeightPx,PopupId)
{
	var myScreenWidth = 1024;
	var myScreenHeight = 768;

    WidthPx = parseInt(WidthPx);
    HeightPx = parseInt(HeightPx) + 20;
    
	if (screen.width)
		myScreenWidth = screen.width;
	if (screen.height)	
		myScreenHeight = screen.height;

	var myTopLeftX = (myScreenWidth - WidthPx) / 2;
	var myTopLeftY = (myScreenHeight - HeightPx) / 2;

	var mypopup = null;
	if (PopupId == 'pic' || PopupId == 'flash' || PopupId == 'picwithmenubar' || PopupId == 'withmenubar') {
		var realHref = 'popup_picture.aspx?href='+Href+'&PopupId='+PopupId+'&width='+WidthPx+'&height='+HeightPx;
		if (PopupId == 'withmenubar')
		    realHref = Href;
		
		var resizable = 0;
		var menubar= 0;
		if (PopupId == 'picwithmenubar' || PopupId == 'withmenubar') {
		    resizable = 1;
		    menubar= 1;
		}
		    
		mypopup = window.open(realHref,'mypopup'+PopupId,'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable='+resizable+', copyhistory=0, menuBar='+menubar+', width='+WidthPx+', height='+HeightPx+', left='+myTopLeftX+', top='+myTopLeftY)
		mypopup.resizeTo(WidthPx + 20, HeightPx + 90);
	}  else {
		mypopup = window.open(Href,'mypopup'+PopupId,'toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+WidthPx+', height='+HeightPx+', left='+myTopLeftX+', top='+myTopLeftY)
	}

    
	mypopup.focus();
	return false;
}

function clickOnEnter(idelement,eventsend)
{
    if(eventsend.keyCode==13 && document.getElementById(idelement))  {
        document.getElementById(idelement).click();
        return false;
    }
}

function showloading()
{
		document.getElementById('loadingouter').style.visibility = 'visible';
		document.getElementById('blocks0').showBar();
		document.getElementById('blocks0').stopPause();
}

function hideloading(HaveParent)
{
	var LoadingDocument;
	if (HaveParent == 'Parent') {
		LoadingDocument = window.parent.document;
	} else {
		LoadingDocument = window.document;
	}
	LoadingDocument.getElementById('loadingDiv').style.visibility = 'hidden';
	LoadingDocument.getElementById('blocks0').hideBar();
	LoadingDocument.getElementById('blocks0').startPause();
}

