function absolute(value)
{
    if (value < 0) return -value;
    return value;
}
function popupwnd(url, targ, width, height, centerwnd){
 var param = 'width='+width + ',height='+height + ',toolbar=no,location=no,scrollbars=yes,menubar=no,status=no,resizable=yes';
 if (centerwnd && !(navigator.userAgent.indexOf('Opera')>=0)){
     param += ",left=" + ((screen.width - width)/2) + ",top=" + ((screen.height-height)/2);
 } else {
     if (centerwnd){         
         param += ",left=" + ((screen.width - width)/2) + ",top=" + (absolute(window.innerHeight-height)/2);
     }
 } 
 var popupWin = window.open(url, targ, param);
 popupWin.focus();
}

function openURL(){
  var url=document.getElementById('url').value;
  if(url!='http://' && url!='') {
      //popupwnd(url, targ, width, height, centerwnd)
  	var win = window.open(url,'','toolbar=yes,location=yes,scrollbars=yes,menubar=yes,status=yes,resizable=yes');
  	win.focus();
  }
}
function previewImg(src, filename, path) {
	document.images['preview_img'].src = src;
	document.images['preview_img'].alt = filename;
	document.getElementById("filename").innerHTML = filename;
	document.getElementById("selected_image_popup").value = path + filename;
	document.getElementById("button").style.visibility = 'visible';
}
function insertImg(_par_num) {
	window.opener.document.getElementById('selected_image' + _par_num).value = document.getElementById("selected_image_popup").value;
	window.opener.document.getElementById('is_image_selected' + _par_num).value = 1;
	window.close();    	
}
function clearImg(_par_num) {
	 document.getElementById("selected_image" + _par_num).value = '';
	 document.getElementById("is_image_selected" + _par_num).value = 0;
}

function displayTab(tabToDisplayName, tabToHideName){
    document.getElementById(tabToDisplayName).style.visibility = 'visible';
    document.getElementById(tabToHideName).style.visibility = 'hidden';
    document.getElementById(tabToDisplayName+'_menu').style.background = '#FFFFFF';
    document.getElementById(tabToHideName+'_menu').style.background = '#FFFFCC';
}
function insertDir(path) {
	window.opener.document.getElementById('selected_dir').value = path;
	window.close();    	
}
function change_language(url){
	if(confirm('Do you want to save the changes made on the current page?')){
		document.getElementById('redirect').value = url;
		document.getElementById('redirect').form.submit();
    } else
    {
    	window.location.href = url;
    }
}