// JScript File
function disableEnter(){
    if ((event.which ? event.which : event.keyCode) == 13){ 
        event.returnValue = false; 
        event.cancel = true;
    }
}

function fnEnterKey(buttonToClick) { 
    if ((event.which ? event.which : event.keyCode) == 13){ 
        event.cancelBubble = true; 
        event.returnValue = false; 
        document.getElementById(buttonToClick).click(); 
    } 
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
/*
function GetTema_CallBack(response){ 
	if (response.error != null){alert(response.error); return;}
	
	document.getElementById("citat").innerHTML = Left(response.value, response.value.length -36);
	document.getElementById("link").innerHTML = "<A href='Default.aspx?gid=d" + Right(response.value, 36) + "'>Meira</A>";
}
function setTemaID(value,elementid){
    document.getElementById(elementid).selected = value;
}
function GetCitatText_CallBack(response){
    if (response.error != null){alert(response.error); return;}
    
    document.getElementById("citat").innerHTML = Left(response.value, response.value.length -36);
    document.getElementById("link").innerHTML = "<A href='Default.aspx?gid=d" + Right(response.value, 36) + "'>Meira</A>";
    
    setTimeout("setCitatUpdate()", 10000);
}
function setCitatUpdate(){
    AjaxFunctions.GetCitatText(GetCitatText_CallBack);
}
// Script for open a popupwindow contains:
// URL, Name, pos. left, pos. top, width, height
// <a HREF="#" onClick="popupPage('/printpage.asp','print','100','100','600','550');">
function popupPage(url,name,l, t, w, h) {
var windowprops = name + ",location=no,scrollbars=yes,menubars=no,toolbars=no,status=yes,resizable=yes" + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;

window.open(url, "", windowprops);
}
*/

// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004

function correctPNG() {
   for(var i=0; i<document.images.length; i++){
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	    }
    }
}
window.attachEvent("onload", correctPNG);


