function CheckInputFile(radUpload, eventArgs)
{
	var image = $("imagePreview");
	if (image)
	{
		var selectedFileName = eventArgs.FileInputField.value.toLowerCase();
		//Get the selected file extension
		var selectedFileExt = selectedFileName.substring(selectedFileName.lastIndexOf(".") + 1);
		
		//Check if the selected file is image
		if (selectedFileExt == "gif" || selectedFileExt == "jpg" || selectedFileExt == "jpeg" || selectedFileExt == "png" || selectedFileExt == "bmp")
		{ 
			image.src = selectedFileName;  
			image.className = 'show';
		}
		else
		{ 
			image.src = "empty.gif";
			image.altText = 'No Image';
			eventArgs.FileInputField.value = '';
			alert(' Image file with extension : gif, jpg, jpeg, png, bmp only"');			
			
			return false;
		}
	} 

}
function ResizeBy(by)
{
	switch(by)
	{
		case 'Width': $('#td_resizebywidth').show();$('#td_resizebyheight').hide();break;
		case 'Height': $('#td_resizebyheight').show();$('#td_resizebywidth').hide();break;
		case '1/2': $('#td_resizebyheight').hide();$('#td_resizebywidth').hide();break;
		case '1/3': $('#td_resizebyheight').hide();$('#td_resizebywidth').hide();break;
		case '1/4': $('#td_resizebyheight').hide();$('#td_resizebywidth').hide();break;
		case 'Specified': $('#td_resizebyheight').show();$('#td_resizebywidth').show();break;
		default: break;
	}
}
function TrashPhoto(title)
{
	var a = window.confirm("Trash Photo " + title + "?");
	if(a){return true;}else{ return false;}
}
function DeletePhoto(title)
{
	var a = window.confirm("Delete Photo " + title + "?");
	if(a){return true;}else{ return false;}
}
function RestorePhoto(title)
{
	var a = window.confirm("Restore Photo " + title + "?");
	if(a){return true;}else{ return false;}
}
function SelectAll()
{
    var chks = $(":checkbox");
	var chk = GBI('lnk_CheckAll');
	if(chk)
	{
		if(chk.className == 'lkcheck')
		{
			chk.className = 'lkcheck2';
			chk = true;
		}
		else
		{
			chk.className = 'lkcheck';
			chk = false;
		}
	} 
	for(var i = 0; i < chks.length; i++)
	{ 
		if(chks[i])
		{
            chks[i].checked = chk;		
		}
	}
}

function Invite_Handler(action)
{  
	if(action){CloseConfirm('div_Invite');return true;}
	else {CloseConfirm('div_Invite');return false;}
}
function ViewPhoto(aid,pid)
{ 
	var l = window.location;
	window.location.href = l.protocol + '//' + l.host + '/Member/Albums.aspx' + '?a=v&i=' + aid + '&p=' + pid;
}
//function ViewAlbum(id)
//{ 
//	var l = window.location;
//	window.location.href = l.protocol + '//' + l.host + l.pathname + '?a=v&i=' + id;
//}
//function EditAlbum(id)
//{
//    if(!id)
//    {
//        alert('No photo available');
//        return false;
//    }
//    
//	var l = window.location;
//	window.location.href = l.protocol + '//' + l.host + l.pathname + '?a=e&i=' + id;
//}
function DeleteAlbum(title)
{
	var a = window.confirm("Delete Album: " + title + "?");
	if(a){return true;}else{ return false;}
}
function Publish(title)
{
	var a = window.confirm("Publish: " + title + "?");
	if(a){return true;}else{ return false;}
}
function RestoreAlbum(title)
{
	var a = window.confirm("Restore Album: " + title + "?");
	if(a){return true;}else{ return false;}
}
function TrashAlbum(title)
{
	var a = window.confirm("Trash Album: " + title + "?");
	if(a){return true;}else{ return false;}
}
function AddAlbum_Handler(action)
{	
	if(action){CloseConfirm('div_add');return true;}
	else {CloseConfirm('div_add');return false;}
}
function DeleteImage(title)
{
	var a = window.confirm("Trash Image " + title + "?");
	if(a){return true;}else{ return false;}
}
function PopPhoto(commentctrl, pid)
{ 
    if(pid)
    {
        LoadComment(pid);
        $('#div_PopPhoto').jqmShow();
        return;
        
        var l = window.location;
       
	    var url = '../Popview/View/' + pid;
        var w= window.open(url,'fpePopviewer','location=0,status=0,scrollbars=0,menubar=0,toolbar=0,height=600,width=600,top=200,left=600',1);
        w.focus();
    }
}
function ShowColor(ddl)
{
	var val = ddl.options[ddl.selectedIndex].value;
	$('spColor').style.backgroundColor =  val;	
}
function ShowFont(ddl)
{
	var val = ddl.options[ddl.selectedIndex].value;
	$('spFont').innerHTML = '<span style="font-family:' + val + '">' + val + '</span>';
}
function MovePhoto()
{
    $('#div_Move').jqmShow();
}