﻿function popupWindow( mypage,myname,w,h,features)
{
	if(screen.width)
	{
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
	}
	else
	{
		winl = 0;wint =0;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	win = window.open(mypage,myname,settings);
	win.window.focus();
}

function isNumeric( input )
{
		if ( parseInt(input, 10) != input ) return false;
		return true;
}

function isEmpty( input )
{
		if ( input == '' ) return true;
		return false;
}

function ConfirmRedirect ( question, positive_url )
{
	if ( confirm(question) )
	{
		this.window.location = positive_url;
	}
}
function scaleImage(image, maxwidth, maxheight ) {
	if (image.width > maxwidth || image.height > maxheight) {
		if (image.width > image.height) {
			image.height = (image.height/image.width)*maxwidth
			image.width = maxwidth
		} else {
			image.width = (image.width/image.height)*maxheight
			image.height = maxheight
		}
		image.style.display = 'block'
	}
}

function hideDebug() {
	var debugDivs = Array()
	debugDivs = document.getElementsByName('solu_debug')
	for (i = 0; i < debugDivs.length; i++) {
		debugDivs[i].style.display = 'none'
	}
}
function toggleDebug() {
	var debugDivs = Array()
	debugDivs = document.getElementsByName('solu_debug')
	for (i = 0; i < debugDivs.length; i++) {
		if (!debugDivs[i].style.display || debugDivs[i].style.display != 'block' || debugDivs[i].style.display == '' || debugDivs[i].style.display == 'none') {
			debugDivs[i].style.display = 'block'
		} else {
			debugDivs[i].style.display = 'none'
		}
	}
}
function MM_preloadImages() { //v3.0
  var d=document; 
  if (d.images) { 
	if(!d.MM_p) d.MM_p=new Array();
	
    var i
	var j = d.MM_p.length
	var a = MM_preloadImages.arguments 
	for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ 
  			d.MM_p[j]=new Image; 
  			d.MM_p[j++].src=a[i];
  		}
  	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function e21_pickObject(name) {
	// First let's test for the W3C DOM Level 1
	if (document.getElementById) {
		return document.getElementById(name)
	} // OK, back to DOM Level 0. Is it IE and similar ?
	else if (document.all) {
		return document.all[name]
	} // Still DOM 0, Is it Netscape and similar?
	else if (document.layers) {
		return document.layers[name]
	} // If none of these match then we return null
	else {
		return null
	}
}

function e21_quickLinkSwap(img, replacement, quickTextElementName, quickTextImg) {
	img.src = replacement
	var quickText = e21_pickObject(quickTextElementName)
	quickText.src = quickTextImg
}

function isFilled(elem){
	var str = elem.value;
	if(str.length == 0){
		return false;
	} 
	else {
		return true;
	}
}


