﻿// JScript File

/////////////////////////////////////////////////////////////////////////////////////////////////////
function HideClipDuration()
    {        
        //var  e = document.getElementById("ctl00_ContentPlaceHolder1_ddlFileType");
        var  e = document.getElementById("ddlFileType");
        //var SelectedId = e.options(e.selectedIndex).value;
        var SelectedId = e.value;
        if (SelectedId=='Video' || SelectedId=='Radio' || SelectedId=='Presenter')
        {
            document.getElementById("divDuration").style.display="inline";
            //document.getElementById("lblFileName").innerText="اسم الكليب ";
            document.getElementById("dmm").selectedIndex=0;
            document.getElementById("dsec").selectedIndex=0;
        }
        else
        {
            document.getElementById("divDuration").style.display="none";
            //document.getElementById("lblFileName").innerText="اسم الملف ";
            document.getElementById("dmm").value=1;
            document.getElementById("dsec").value=1;            
        }
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////
function txtCommentGotFocus(value,txtComment)
{
    if(value == 'اضف تعليقك')
    {
        txtComment.value = '';
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
function txtCommentLostFocus(value,txtComment)
{
    if(value == '')
    {
        txtComment.value = 'اضف تعليقك';
    }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////    
  function validatePhotoFileType(guid)
    {
        alert('proc..11');
        document.getElementById("spanFileTypeError").innerHTML='';
        var FileName = document.getElementById("File1").value;
        if (FileName=='')
        {
            document.getElementById("hdPhotoFileExist").value = 'yes';
            alert('proc..1111');
            return true;
        }
         else if(!/(\.jpg|\.tif|\.bmp|\.jpeg|\.png|\.gif)$/i.test(FileName))
            {
	            document.getElementById("spanFileTypeError").innerHTML="نوع الملف غير مقبول, فقط jpg, bmp, jpeg, gif, png و tif  مسموح به.";
	            document.getElementById("spanFileTypeError").style.display="inline";
	            alert('proc..1122');
	            return false;
            }
        document.getElementById("spanFileTypeError").style.display="none";
        document.getElementById("divKUploadProgress").style.display="inline";
        KUploadPlus_Start(guid);  
        alert('proc..22');
        return true;   
    
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////    
        
    function validateFileType(guid)
    {   document.getElementById("spanFileTypeError").innerHTML='';
        var FileName = document.getElementById("File1").value;
        var FileType = document.getElementById("ddlFileType").value;
        if (FileType == 'Video')
        {
            if(!/(\.3gp|\.dat|\.mpeg|\.avi|\.wmv|\.m3u|\.mpg|\.mp4|\.mov)$/i.test(FileName)) 
            {

		        document.getElementById("spanFileTypeError").innerHTML="نوع ملف الفيديو غير مقبول, فقط 3GP, DAT, <br/> MPEG, AVI, WMV, MPG, MP4 و MOV مسموح به. ";
		        document.getElementById("spanFileTypeError").style.display="inline";
		        return false;
	        }
        }
        else if (FileType == 'Radio')
        {

            if(!/(\.mp3|\.wav|\.amr|\.wma)$/i.test(FileName)) 
            {

		        document.getElementById("spanFileTypeError").innerHTML="نوع الملف الصوتي غير مقبول, فقط MP3, WAV, WMA و AMR مسموح به.";
		        document.getElementById("spanFileTypeError").style.display="inline";
		        return false;
	        }
        }
        else if (FileType == 'Press')
        {
            if(!/(\.pdf|\.rtf|\.txt|\.xls|\.xlsx|\.doc|\.docx|\.ppt|\.pptx|\.pps|\.xlsx)$/i.test(FileName)) 
            {

		        document.getElementById("spanFileTypeError").innerHTML="نوع الملف غير مقبول, فقط PDF, RTF, DOC, DOCX, TXT, XLS, XLSX, PPT, PPTX و PPS مسموح به.";
		        document.getElementById("spanFileTypeError").style.display="inline";
		        return false;
	        }
        }
        else if (FileType == 'Presenter') 
        {
            if(!/(\.3gp|\.dat|\.mpeg|\.avi|\.wmv|\.m3u|\.mpg|\.mp4|\.mov)$/i.test(FileName)) 
            {

	            document.getElementById("spanFileTypeError").innerHTML="نوع ملف الفيديو غير مقبول, فقط 3GP, DAT, <br/> MPEG, AVI, WMV, M3U, MPG, MP4 و MOV مسموح به. ";
	            document.getElementById("spanFileTypeError").style.display="inline";
	            return false;
            }
        }
       else if (FileType == 'Photo' || FileType == 'Graphics')
       {
             if(!/(\.jpg|\.tif|\.bmp|\.jpeg|\.png|\.gif)$/i.test(FileName))
            {
	            document.getElementById("spanFileTypeError").innerHTML="نوع الملف غير مقبول, فقط jpg, bmp, jpeg, gif, png و tif  مسموح به.";
	            document.getElementById("spanFileTypeError").style.display="inline";
	            return false;
            }
       }
        document.getElementById("spanFileTypeError").style.display="none";
        document.getElementById("divKUploadProgress").style.display="inline";
        KUploadPlus_Start(guid);  
        return true;      
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////

