
function setUploadLogo2()
{
	var filename = Media.displayFileDialog();

	if(Media.validateBitmap(filename))
	{
		easoMain.SetVariable("/mcDialog:txtCustomLogoData",setCustomLogo(filename));
		easoMain.SetVariable("/mcDialog:txtCustomLogo",filename);
	}
	else if(filename != "")
	{
		easoMain.SetVariable("/mcDialog:imageValid",false);
		easoMain.SetVariable("/mcDialog:txtCustomLogo","");
	}
}

function setUploadLogo()
{
	var filename = Media.displayFileDialog();

	if(Media.validateBitmap(filename))
	{
		easoMain.SetVariable("/mcContent1:txtCustomLogoData",setCustomLogo(filename));
		easoMain.SetVariable("/mcContent1:txtCustomLogo",filename);
	}
	else if(filename != "")
	{
		easoMain.SetVariable("/mcContent1:imageValid",false);
		easoMain.SetVariable("/mcContent1:txtCustomLogo","");
	}
}

function isLogoImageValid( sImgSrc ) 
{
	tempImg.src = sImgSrc;
	var bImageValid = true;
	if ( sImgSrc != "" ) 
	{
		var img = sImgSrc;
		img = img.toLowerCase();
		var logo_sizeCheck = document.getElementById('tempImg');
		//alert(img);
        
        if(logo_sizeCheck.width > 130)
        {
        	alert("iamge too large");
      		bImageValid = false;
      	}
        if(logo_sizeCheck.height > 128)
        {
        	alert("iamge too large");
        	bImageValid = false;
        }

        if(/*img.length - img.lastIndexOf(".gif") == 4 ||*/ img.length - img.lastIndexOf(".jpg") == 4 ||  img.length - img.lastIndexOf(".jpe") == 4 || img.length - img.lastIndexOf(".jpeg") == 5)
		{
        	// do nothing
        }
		else
		{
			alert("not an image");
        	bImageValid = false;
        }
				// hack to add the extra "/" to the file path
        var slash = "%5C"
      //  img = img.substring(0,3)+unescape(slash)+img.substring(3,img.length);
      	var fso = new ActiveXObject("Scripting.FileSystemObject");
      	if ( fso.FileExists(img) == false)
      	{
      		alert("SERVER_ERROR_10016");
	    	bImageValid = false;
      	}
        var fileSize = fso.GetFile(img).size;

        if(fileSize > 32786)
		{
			alert("iamge file too large");
			bImageValid = false;
        }
	}
	else
		return false;

    if(bImageValid==false)
	{
		//alert("false");
	    return false;
	}
	else
	{
		//alert("true");
		return true;
	}
}

function setCustomLogo(fname)
{
	var strSourcePath = fname;
	strSourcePath.replace(/\//g, "\\");
	var imgPostData = (Media.UUEncodeFile(strSourcePath));
	return imgPostData;

}