﻿// JScript File

// JScript File

function OpenNewWindow(wpath)
{
     window.open(wpath,null,"height=500,width=550,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");    
}

function OpenNewWindowCouponCode(wpath)
{
     window.open(wpath,null,"height=450,width=750,status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");    
}

function OpenNewWindowVideo(wpath)
{
     window.open(wpath,null,"height=410,width=440,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no");    
}

function OpenNewPopUpWindow(wpath)
{
    window.open(wpath,null,"height=200,width=450,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");    
    //window.showModalDialog(wpath,"Hi","dialogWidth:450px;dialogHeight:200px");
}

function IsValidDate(Day,Mn,Yr){
    var DateVal = Mn + "/" + Day + "/" + Yr;
    var dt = new Date(DateVal);

    if(dt.getDate()!=Day){
        alert('Invalid Date');
        return(false);
        }
    else if(dt.getMonth()!=Mn-1){
    //this is for the purpose JavaScript starts the month from 0
        alert('Invalid Date');
        return(false);
        }
    else if(dt.getFullYear()!=Yr){
        alert('Invalid Date');
        return(false);
        }
        
    return(true);
 }



function CallDateFun(sender, args){
   var mySplitResult = args.value.split("/");
   
   var d=mySplitResult[0];
   var m=mySplitResult[1];
   var y=mySplitResult[2];

   if(IsValidDate(d,m,y))
        args.IsValid=true;
   else
        args.IsValid=false;
}


function openColourPickerDialog(wnd, field, dlgURL)
{
 myColourDialog.myColour="";
 if(wnd.showModalDialog(
    dlgURL,
     myColourDialog,
     "dialogHeight:150px;dialogWidth:300px;") 
       == true )
 {
  field.value = myColourDialog.myColour;
 }
 else
 {
  return;
 }
}


// function DisplayPopup(link, ClientId,ClientName,NoOfUser)
function DisplayPopup()
   {    
   //debugger;
        //hideErrorMsg(); //alert(document.getElementById('btnGridCancel').style.visibility);// try {grdClient.cancel();}catch(ex){}
        var top=0
        var height=screen.availHeight
        var left=0
        var width=screen.availWidth
        
        document.getElementById('dvPopup').style.top=top;
        document.getElementById('dvPopup').style.left=left;
        document.getElementById('dvPopup').style.height=height;
        document.getElementById('dvPopup').style.width=width;
//        if(flag==true)
//        {grdClient.cancel()}
        document.getElementById('dvPopup').style.display='block';
//        document.getElementById('<%=ValidationSummary1.ClientID%>').style.display='none';
//        document.getElementById('<%=RequiredFieldValidator1.ClientID%>').style.display='none';
//        document.getElementById('<%=RegularExpressionValidator3.ClientID%>').style.display='none';
//        document.getElementById('<%=hdfClientId.ClientID%>').value=ClientId;
//        document.getElementById('<%=lblClientName.ClientID%>').innerHTML=ClientName;
//        document.getElementById('<%=txtNoOfUsers.ClientID%>').value=NoOfUser;
        return false;
   }