﻿//function to assign shipping information ssame as general information
//created by:  Jagmohan Singh 
//created date:2006-09-21
function SameShipInfo()
{
    if (document.getElementById('ctl00_cphMain_AddEditMember1_chkSame').checked == true)
    {
    var ddl = document.getElementById('ctl00_cphMain_AddEditMember1_ddlShipState');
    var count = ddl.options.length;
    var i;
    for(i=0;i<count;i++)  
    {
        if (ddl.options[i].value == document.getElementById('ctl00_cphMain_AddEditMember1_ddlState').value)
        {
            ddl.options[i].selected = true; 
        }
    }
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipAddress').value = document.getElementById('ctl00_cphMain_AddEditMember1_txtAdress').value ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipSuburb').value = document.getElementById('ctl00_cphMain_AddEditMember1_txtSuburb_txtChild').value ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipFname').value = document.getElementById('ctl00_cphMain_AddEditMember1_txtFirstName_txtChild').value ;
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipLname').value = document.getElementById('ctl00_cphMain_AddEditMember1_txtLastName').value ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipPhone_txtChild').value =  document.getElementById('ctl00_cphMain_AddEditMember1_txtPhone_txtChild').value ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipCity').value =document.getElementById('ctl00_cphMain_AddEditMember1_txtCity_txtChild').value ; 
        //document.getElementById('ctl00_cphMain_AddEditMember1_txtShipState').value =document.getElementById('ctl00_cphMain_AddEditMember1_txtState').value ; 
        //document.getElementById('ctl00_cphMain_AddEditMember1_txtShipCountry').value =document.getElementById('ctl00_cphMain_AddEditMember1_txtCountry').value ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipPostalCode_txtChild').value =document.getElementById('ctl00_cphMain_AddEditMember1_txtPostalCode_txtChild').value ; 
        
    }
    else
    {
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipFname').value = "";
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipLname').value = ""; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipPhone_txtChild').value =  ""; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipCity').value = ""; 
        //document.getElementById('ctl00_cphMain_AddEditMember1_txtShipState').value =document.getElementById('ctl00_cphMain_AddEditMember1_txtState').value ; 
        //document.getElementById('ctl00_cphMain_AddEditMember1_txtShipCountry').value = "" ; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipPostalCode_txtChild').value = ""; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipAddress').value = ""; 
        document.getElementById('ctl00_cphMain_AddEditMember1_txtShipSuburb').value = "";
    }
}

//function to assign shipping information same as general information in SwapOrder.aspx
//created by:  Preeti Jain 
//created date:2006-09-28
function FillValuesBillingToShipping()
{
    if(document.getElementById("ctl00_cphMain_AddEditSwap_chkSameBillingInfo").checked)
    {
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipFName_txtChild").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillFName_txtChild").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipLName_txtChild").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillLName_txtChild").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipAddress").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillAddress").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipSuburb_txtChild").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillSuburb_txtChild").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipCity_txtChild").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillCity_txtChild").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipState_txtChild").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillState_txtChild").value;
        //document.getElementById("ctl00_cphMain_AddEditSwap_txtShipCountry").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillCountry").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipPostCode").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillPostCode").value;
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipTelephone").value = document.getElementById("ctl00_cphMain_AddEditSwap_txtBillTelephone").value;
    }
    else
    {
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipFName_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipLName_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipAddress_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipSuburb_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipCity_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipState_txtChild").value = "";
        //document.getElementById("ctl00_cphMain_AddEditSwap_txtShipCountry_txtChild").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipPostCode").value = "";
        document.getElementById("ctl00_cphMain_AddEditSwap_txtShipTelephone").value = "";
   }
}

//function to check the textarea length
//created by:  Preeti Jain 
//created date:2006-10-13
function chkTextAreaLength(element,maxlen)
{
    var str	=	element.value;
    var maximumlength	=	parseInt(maxlen);
    if(element.value.length > parseInt(maxlen))
    {
        element.value	=	str.substring(0,maximumlength);
        alert("Only "+maxlen +" characters are allowed.");
    }
    return false;
}

//function to display a message if checkbox is unchecked
//created by:  Preeti Jain 
//created date:2006-10-13
function validatePolicyCheckbox(source,arguments)
{

    var str	=	element.value;
    if (!element.checked)
    {
        alert("Please make sure that you agree with site's privacy policy.");
        //return false;
        arguments.IsValid = false;
    }
    else
    {
       //return true;
       arguments.IsValid = true;
    }
    
   
}
//function to open pop up for news  
//created by:  Preeti Jain 
//created date:2006-10-13
function NewsPopup(theURL) 
{
	//alert("a");

    w=675;
	h=575;
	t=50;
	l=50;
	maxWidth=675;
	maxHeight=575;
	
	/*if (document.all) 
	{
		maxWidth=screen.availWidth;
		maxHeight=screen.availHeight;
	}*/
	
	if (w > maxWidth) { w=maxWidth }
	if (h > maxHeight) { h=maxHeight }
	l=(maxWidth-w)/2
	t=(maxHeight-h)/2
	window.open(theURL,"imgWin","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");
	return false;
}
//function open pop up for chat 
//created by:  Jagmohan Singh
//created date:2006-10-30
function Popup(theURL) 
{
    window.open(theURL,"","location=1,status=1,scrollbars=1,width=655,height=415"); 
}
//function to show and hide upload photo panel in blogs
//created by:  Jagmohan Singh
//created date:2006-10-30
function UploadPhoto()
    {
        if ( document.getElementById("ctl00_cphMain_pnlUploadPhoto").style.display == 'none')
        {
            document.getElementById("ctl00_cphMain_pnlUploadPhoto").style.display = "block";
        }
        else
        {
            document.getElementById("ctl00_cphMain_pnlUploadPhoto").style.display = "none";
        }
    }


function backcolorHeader(strID,srtPath)
{
	try
	{
		if (strID != "")
		{
		    var str = document.getElementById(strID);
		    if(str != null)
			    str.style.backgroundImage='url('+ srtPath+'/images/topbtn_bg_orange.gif)';
		}
	}
	catch(e)
	{
	}
}
function HideMessageBox()
{
  
    var str = document.getElementById('div-message');
		    if(str != null)
		    {
			    str.style.display = "block";
			      //alert(str);
			      return false;
			}
     else
        return true;
                
}



/*function ValidateProduct(intPCGID)
{
    var ctrl1;
    var ctrl2;
    var ctrl3;
    var blnVolume = true;
    var blnCost = true;
    var blnResult = true;
    
    if (intPCGID==1)//Movies
    {
        
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        ctrl2=document.getElementById('ctl00_cphMain_AddEditProduct_txtCost');
        blnVolume = IsNumeric(ctrl1.value, false);
        blnCost = IsNumeric(ctrl2.value, false);
        if ((blnVolume == false) && (blnCost == false))
        {
            alert("# of Discs and Run Time should be numeric.");
            blnResult = false;
        }
        else if ((blnVolume == false) && (blnCost == true))
        {
            alert("# of Discs should be numeric.");
            blnResult = false;
        }
        else if ((blnVolume == true) && (blnCost == false))
        {
            alert("Run Time should be numeric.");
            blnResult = false;
        }
        //if (document.getElementById('ctl00_cphMain_AddEditProduct_txtTitle_txtChild').value==0)
          //  blnResult = false;
    }
    else if (intPCGID==2)//Music
    {
        blnResult = true;
    }
    else if (intPCGID==3)//Games
    {
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        if (IsNumeric(ctrl1.value, false) == false) 
        {
            alert("No. of Players should be numeric.");
            blnResult = false;
        }
    }
    else if (intPCGID==4)//Books
    {
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        if (IsNumeric(ctrl1.value, true) == false) 
        {
            alert("Volume should be numeric.");
            blnResult = false;
        }
    }
    return blnResult;
}
*/

function TestFileType( fileName, fileTypes ) 
{
	fileName=fileName.toLowerCase();
	if (!fileName) return;
	dots = fileName.split(".")
	fileType =dots[dots.length-1];
	return (fileTypes.join(" ").indexOf(fileType) != -1);
}


//date functions//
function GetMonth(nMonth)
{
	var Months = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
	return Months[nMonth] 	  	 
}

function DateString()
{
	var Today = new Date();
	var suffix = "th";
	switch (Today.getDate())
	{
		case 1:
		case 21:
		case 31: 
			suffix = "st"; break;
		case 2:
		case 22:
			suffix = "nd"; break;
		case 3:
		case 23:
			suffix = "rd"; break;
	};
    try
    {
	    strDate = GetMonth(Today.getMonth())  + "/" + Today.getDate() + "/" + Today.getFullYear();
	    var c_hour = Today.getHours();
   	    var c_min = Today.getMinutes();
   	    var c_sec = Today.getSeconds();
	    strDate += " " + c_hour  + ":" + c_min + ":" + c_sec
    	//alert(Today.getDate());
	}
	catch(ex)
	{
	    strDate = '';
	}
	return strDate;	
}
//date functions//



function ValidateProduct(intPCGID)
{
    var objRegExpDate = /^(((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])(\d{4}))|((29)(\.|-|\/)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26])))+$/;
    var objRegExpPoint =/^(\d|,)*\.?\d*$/;
    var objRegExpQty =/^(\d)*$/;
    
    var ctrl1;
    var ctrl2;
    var ctrl3;
    var dtctrl;
    var blnVolume = true;
    var blnCost = true;
   // var blnResult = true;
    //document.write()
     dtctrl =  document.getElementById('ctl00_cphMain_AddEditProduct_txtListedDate');
     dtctrl.value = DateString();
     //alert(dtctrl.value);
      
       
       str=document.getElementById('ctl00_cphMain_AddEditProduct_txtCode_txtChild').value;
		if(str=="")
		{
			alert("Please enter bar code.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtCode_txtChild').focus();
			return false;
		}
		
		
		 str=document.getElementById('ctl00_cphMain_AddEditProduct_txtTitle_txtChild').value;
		if(str=="")
		{
			alert("Please enter title.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtTitle_txtChild').focus();
			return false;
		}
		
		
		if (intPCGID==1)//Movies
        {
            str=document.getElementById('ctl00_cphMain_AddEditProduct_txtCompany').value;
            //flag = str.match(objRegExpPoint);
		    if(str=="")
		    {
			    alert("Please enter rating.");
			    document.getElementById('ctl00_cphMain_AddEditProduct_txtCompany').focus();
			    return false;
		    }
		    /*if(flag==null)
		    {
			    alert("Please enter valid rating.");
			    document.getElementById('ctl00_cphMain_AddEditProduct_txtCompany').focus();
			    return false;
		    }*/
		}
		else if (intPCGID==2) //Music 
        {
            str=document.getElementById('ctl00_cphMain_AddEditProduct_txtRoleBy_txtChild').value;
            if(str=="")
		    {
                alert("Please enter artist.");  
                document.getElementById('ctl00_cphMain_AddEditProduct_txtRoleBy_txtChild').focus();
		        return false;
            }
        }
        else if (intPCGID==4) //Books
        {
            str=document.getElementById('ctl00_cphMain_AddEditProduct_txtRoleBy_txtChild').value;
            if(str=="")
		    {
                alert("Please enter author.");  
                document.getElementById('ctl00_cphMain_AddEditProduct_txtRoleBy_txtChild').focus();
		        return false;
            }
        }
		
		str=document.getElementById('ctl00_cphMain_AddEditProduct_txtPoint_txtChild').value;
		flag = str.match(objRegExpPoint);
		if(str=="")
		{
			alert("Please enter points.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtPoint_txtChild').focus();
			return false;
		}
		if(flag==null)
		{
			alert("Please enter valid points.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtPoint_txtChild').focus();
			return false;
		}
		
		str=document.getElementById('ctl00_cphMain_AddEditProduct_txtQuantity_txtChild').value;
		flag = str.match(objRegExpQty);
		if(str=="")
		{
			alert("Please enter quantity.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtQuantity_txtChild').focus();
			return false;
		}
		if(flag==null)
		{
			alert("Please enter valid quantity.");
			document.getElementById('ctl00_cphMain_AddEditProduct_txtQuantity_txtChild').focus();
			return false;
		}
		
		
		
		
	/*	str=document.getElementById('ctl00_cphMain_AddEditProduct_txtYear_txtChild').value;
        flag = str.match(objRegExpDate);
		if(str!="")
		{
		    if(flag==null)
		    {
			    alert("Please enter valid date.");
			    document.getElementById('ctl00_cphMain_AddEditProduct_txtYear_txtChild').focus();
			    return false;
		    }
		}*/
		
		
		
    if (intPCGID==1)//Movies
    {        
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
            if (ctrl1.value != '')
            {
                alert("# of Discs should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
        
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtCost');
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
            if (ctrl1.value != '')
            {
                alert("Run Time should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
    }
    else if (intPCGID==2)//Music
    {
        //return true; 
    }
    else if (intPCGID==3)//Games
    {
        
        ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
            if (ctrl1.value != '')
            {
                alert("No. of Players should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
    }
    else if (intPCGID==4)//Books
    {
         ctrl1=document.getElementById('ctl00_cphMain_AddEditProduct_txtVolume');
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
            if (ctrl1.value != '')
            {
                alert("Volume should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
    }
    
    if(document.getElementById('ctl00_cphMain_AddEditProduct_chkItemOriginal').checked == false)
		{
			alert("Please select that product is original.");
			document.getElementById('ctl00_cphMain_AddEditProduct_chkItemOriginal').focus();
			return false;
		}
    
    
    if (document.getElementById("ctl00_cphMain_AddEditProduct_txtThumbnail").value != "")
		{
		    if(!TestFileType(document.getElementById("ctl00_cphMain_AddEditProduct_txtThumbnail").value, ['pjpeg', 'jpeg','jpg','gif']))
			    {
				    alert("Thumbnail is not valid. \n Only pjpeg, jpeg,jpg ,gif formats are allowed.");
				    document.getElementById("ctl00_cphMain_AddEditProduct_txtThumbnail").focus();
				    return false;
			    }
		}
		if (document.getElementById("ctl00_cphMain_AddEditProduct_txtImage").value != "")
		{
		    if(!TestFileType(document.getElementById("ctl00_cphMain_AddEditProduct_txtImage").value, ['pjpeg', 'jpeg','jpg','gif']))
			    {
				    alert("Image is not valid. \n Only pjpeg, jpeg,jpg ,gif formats are allowed.");
				    document.getElementById("ctl00_cphMain_AddEditProduct_txtImage").focus();
				    return false;
			    }
		}
		
    return true;
}




function ValidateList(intPCGID)
{
    var objRegExpDate = /^(((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])(\d{4}))|((29)(\.|-|\/)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26])))+$/;
    
    var ctrl1;
    var ctrl2;
    var ctrl3;
    var blnVolume = true;
    var blnCost = true;
   // var blnResult = true;
    str=document.getElementById('ctl00_cphMain_txtTitle_txtChild').value;
		if(str=="")
		{
			alert("Please enter title.");
			document.getElementById('ctl00_cphMain_txtTitle_txtChild').focus();
			return false;
		}
		
		/*if(flag==null)
		{
			alert("Last name is not valid. \n Only alphabets are allowed.");
			document.frmContactor.txtLastName.focus();
			return false;
		}
		
		str=document.getElementById('ctl00_cphMain_txtYear').value;
        flag = str.match(objRegExpDate);
		if(str!="")
		{
		    if(flag==null)
		    {
			    alert("Please select valid date.");
			    document.getElementById('ctl00_cphMain_txtYear').focus();
			    return false;
		    }
		}*/
		
		
		
		
    if (intPCGID==1)//Movies
    {
        
        
//        ctrl1=document.getElementById('ctl00_cphMain_txtVolume');
//        blnVolume = IsNumeric(ctrl1.value, false);
//        if (blnVolume == false)
//        {
//            alert("# of Discs and Run Time should be numeric.");
//            ctrl1.focus();
//            return false;
//        }
        
        
        
        ctrl1=document.getElementById('ctl00_cphMain_txtVolume');
        if (ctrl1.value!="")
        {
            blnVolume = IsNumeric(ctrl1.value, false);
            //alert(blnVolume);
            if (blnVolume == false)
            {
                alert("# of Discs should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
        
        ctrl1=document.getElementById('ctl00_cphMain_txtCost');
        if (ctrl1.value!="")
        {
            blnVolume = IsNumeric(ctrl1.value, false);
            if (blnVolume == false)
            {
                alert("Run Time should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
        
    }
    else if (intPCGID==2)//Music
    {
        return true; 
    }
    else if (intPCGID==3)//Games
    {
        ctrl1=document.getElementById('ctl00_cphMain_txtVolume');
       
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
            if (ctrl1.value != '')
            {
              alert("No. of Players should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
       
    }
    else if (intPCGID==4)//Books
    {
         ctrl1=document.getElementById('ctl00_cphMain_txtVolume');
        blnVolume = IsNumeric(ctrl1.value, false);
        if (blnVolume == false)
        {
             if (ctrl1.value != '')
            {
                alert("Volume should be numeric.");
                ctrl1.focus();
                return false;
            }
        }
    }
    if (document.getElementById("ctl00_cphMain_txtThumbnail").value != "")
		{
		    if(!TestFileType(document.getElementById("ctl00_cphMain_txtThumbnail").value, ['pjpeg', 'jpeg','jpg' ,'rtf','gif']))
			    {
				    alert("Thumbnail is not valid. \n Only pjpeg, jpeg,jpg ,gif formats are allowed.");
				    document.getElementById("ctl00_cphMain_txtThumbnail").focus();
				    return false;
			    }
		}
			if (document.getElementById("ctl00_cphMain_txtImage").value != "")
			{
			    if(!TestFileType(document.getElementById("ctl00_cphMain_txtImage").value, ['pjpeg', 'jpeg','jpg' ,'rtf','gif']))
			    {
				    alert("Image is not valid. \n Only pjpeg, jpeg,jpg ,gif formats are allowed.");
				    document.getElementById("ctl00_cphMain_txtImage").focus();
				    return false;
			    }
			}
    
    return true;;
}



//  check for valid numeric strings	
function IsNumeric(strString, blnDecimal)
{
    var objRegExpNumeric = "^\\d+$";
    var strChar;
    var blnResult = true;
    
    flag = strString.match(objRegExpNumeric);
    if(flag==null)
		{
			blnResult = false;
		}
   return blnResult;
}

function GoClick()
{
    if(document.getElementById("ctl00_header_txtSearch").value == 'Search' || document.getElementById("ctl00_header_txtSearch").value == '')
    {
       // alert('Please enter search keyword');
        return false;
    }
    else
    {
        return true;
    }
}
function ValidateLogin()
{
   var objRegExp = /^([a-zA-Z0-9_])+$/;
    //var objRegExpPoint =/^(\d|,)*\.?\d*$/;
   
   var str;
   try
   {
        str=document.getElementById("ctl00_ucLogin_icInnerLogin_txtUser").value;
		flag = str.match(objRegExp);
		if(str=="")
		{
			alert("Please enter login name.");
			document.getElementById("ctl00_ucLogin_icInnerLogin_txtUser").focus();
			return false;
		}
		if(flag==null)
		{
			alert("Please enter valid login name.");
			document.getElementById("ctl00_ucLogin_icInnerLogin_txtUser").focus();
			return false;
		}
		
		str=document.getElementById("ctl00_ucLogin_icInnerLogin_txtPassword").value;
		flag = str.match(objRegExp);
		if(str=="")
		{
			alert("Please enter password.");
			document.getElementById("ctl00_ucLogin_icInnerLogin_txtPassword").focus();
			return false;
		}
		return true;
	}
	catch(ex)
	{	
		str=document.getElementById("ctl00_cphMain_Login1_txtUser").value;
		flag = str.match(objRegExp);
		if(str=="")
		{
			alert("Please enter login name.");
			document.getElementById("ctl00_cphMain_Login1_txtUser").focus();
			return false;
		}
		if(flag==null)
		{
			alert("Please enter valid login name.");
			document.getElementById("ctl00_cphMain_Login1_txtUser").focus();
			return false;
		}
		str=document.getElementById("ctl00_cphMain_Login1_txtPassword").value;
		flag = str.match(objRegExp);
		if(str=="")
		{
			alert("Please enter password.");
			document.getElementById("ctl00_cphMain_Login1_txtPassword").focus();
			return false;
		}
		return true;
  }
  
}

function ValidateDateFilter()
{
    if (document.getElementById("ctl00_cphMain_txtFromDate").value == '')
        {
            alert('Please select from date');
            return false;
        }
    else if(document.getElementById("ctl00_cphMain_txtToDate").value == '')    
        {
            alert('Please select to date');
            return false;
        }
}


//NEWS SCROLLER

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee()
{
try
{
    cross_marquee=document.getElementById("vmarquee")
    cross_marquee.style.top=0
    marqueeheight=document.getElementById("marqueecontainer").offsetHeight
    actualheight=cross_marquee.offsetHeight
    if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1)
    { //if Opera or Netscape 7x, add scrollbars to scroll and exit
        cross_marquee.style.height=marqueeheight+"px"
        cross_marquee.style.overflow="scroll"
        return
    }
    setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}
catch(ex)
{}
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee

//for remort date time

function GetLocalTimeOffset()
     {
       var rightNow = new Date();
       var date1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
     
       var temp = date1.toGMTString();
       var date2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
      
       var hoursDiffStdTime = (date1 - date2) / (1000 * 60 * 60);
       //alert(document.getElementById("ctl00_cphMain_lblLocalDateOffset"));
       //document.getElementById("ctl00_cphMain_lblLocalDateOffset").value = hoursDiffStdTime;
        return hoursDiffStdTime;
        //createCookie("hoursDiffStdTime", hoursDiffStdTime, 0); 

     }
