﻿//$("div.test").add("p.quote").addClass("blue").slideDown("slow");
//$.each([1,2,3], function() 
//{
//  document.write(this + 1);
//});
//$.ajax({
//  type: "POST",
//  url: "some.php",
//  data: "name=John&location=Boston",
//  success: function(msg){
//    alert( "Data Saved: " + msg );
//  }
//});

/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Update: April 12th, 10: Fixed compat issue with jquery 1.4x

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
function GoodMenu()
{
var strVirtualPath=document.getElementById('ctl00_hdnVirtualPath').value;
var linkRightArrow=0;// $("input[name$=hdnVirtualPath]").val();   //$("input[id$=ctl00_hdnVirtualPath]").val()//$("#ctl00_hdnVirtualPath").val();
var linkDownArrow=0;
linkDownArrow="images/down.gif";
linkRightArrow="images/right.gif";
//alert(linkDownArrow);
//var strVirtualPath=$("input[name$=hdnVirtualPath]").val();
//alert(linkRightArrow);
//alert(document.getElementById("<%=hdnVirtualPath.ClientID%>").value);

//document.Form1.item("tytry").value
 //var singleValues = document.getElementById('ctl00_hdnVirtualPath').value(); // $("input[id=ctl00_hdnVirtualPath]").val(); // $('[id=hdnVirtualPath]').Val(); 
//alert(singleValues );
//$(document).ready(function() {
//            alert($("input[id$=hdnValue]").val());
//        });
//$(document).ready(function() {   
//          document.title = ($("input[name$=hdnVirtualPath]").val());   
//          
//        });   



//var arrowimages={down:['downarrowclass', '/Interface/Images/down.gif', 23], right:['rightarrowclass', 'Images/right.gif']}
var arrowimages={down:['downarrowclass',linkDownArrow , 23], right:['rightarrowclass', linkRightArrow]}

var jqueryslidemenu={

animateduration: {over: 250, out: 100}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img  src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
			$curobj.click(function(){
				$(this).children("ul:eq(0)").hide()
			})
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)
}
//function OpenModalPopup(PageUrl,Qry)
//{
// //   var returnedValue;
//    if (window.showModalDialog)
//    {
//  returnedValue=  window.showModalDialog(PageUrl,"#1","dialogHeight: 300px; dialogWidth: 600px;" +  
//                    "dialogTop: 190px;  dialogLeft: 220px; edge: Raised; center: Yes;" + 
//                    "help: No; resizable: No; status: No;");
//        //if(Qry!='')
//       /// window.showModalDialog(PageUrl,"dialogWidth=500px; center:yes;dialogHeight=300px;resizable=yes;help=no;unadorned=yes");
//       // else
//       // window.showModalDialog(PageUrl,"dialogWidth=500px;center:yes; dialogHeight=300px;resizable=yes;help=no;unadorned=yes");
//    }
//    else
//    {
//        if(Qry!='')
//        window.open(PageUrl,"height=200,width=200,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes");
//        else
//        window.open(PageUrl,"height=200,width=200,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes");
//    }
//    if(returnedValue==null)
//    alert("NUll");
//    else
//    alert("value");
//    
//}
function OpenModalPopup(PageUrl) 
{
    var ParmA = document.getElementById('retvalA').value;
    var ParmB = document.getElementById('retvalB').value; 
    var ParmC = document.getElementById('retvalC').value; 
    var MyArgs = new Array(ParmA, ParmB, ParmC);
    var WinSettings = "dialogHeight: 300px; dialogWidth: 600px; dialogTop: 190px;  dialogLeft: 220px; edge: Raised; center: Yes; help: No; resizable: No; status: No;";
    // ALTER BELOW LINE - supply correct URL for Child Form
    var MyArgs2 = window.showModalDialog(PageUrl, "#1", WinSettings);
    if (MyArgs2 == null)
    {
    window.alert("Nothing returned from child. No changes made to input boxes");
    }
    else
    {
    alert(MyArgs2);
    //document.getElementById('retvalA').value=MyArgs2[0].toString();
    //document.getElementById('retvalB').value=MyArgs2[1].toString();
    //document.getElementById('retvalC').value=MyArgs2[2].toString();
    }
}
//$(document).ready(function() 
//{ 
//$("#dialog").dialog({ 
//    bgiframe: true, 
//    autoOpen: false, 
//    height: 300, 
//    modal: true, 
//    buttons: { 
//        Cancel: function() { 
//            $(this).dialog("close"); 
//        } 
//    }, 
//    close: function() { 
//        allFields.val("").removeClass("ui-state-error"); 
//    } 
//}); 
// 
//var isAuthenticated = $("#isAuthenticated").val(); 
//if (isAuthenticated && isAuthenticated == "false") { 
//    // Display the modal dialog. 
//    $("#dialog").dialog("open"); 
//}}); 

function trimStr(str)
{
    var i, pBegin, pEnd, strTemp
     //find the preceeding spaces
     for (i = 0 ; i < String(str).length; i++)
     {if (String(str).charAt(i) != " ")
        {pBegin = i;
         break;
        }
     }
     
     //find ending spaces
     for (i = String(str).length -1; i >= 0; i--)
     {if (String(str).charAt(i) != " ")
        {pEnd = i;
         break;
        } 
     }
     
     //the new string.
     strTemp = String(str).substr(pBegin, pEnd - pBegin +1 );
     return (strTemp);
}

function ValidateLogin()
{
    var txt = document.getElementById('txtLoginCode');
    if(trimStr(txt.value).length == 0)
    {
        alert('Please enter the Login Id');
        return false;
    }
    else
    {
        txt.blur();
        showHideScreenSplash("Please wait while validating your Credentials");
        return true;
    }
}

function ValidateEnter(txt)
{
    if(event.keyCode == 13)
    {
        if(txt.value.length == 0)
        {
            alert('Enter Login Id');
            return false;
        }
        else
        {
            txt.blur();
            showHideScreenSplash("Please wait while validating your employeecode");
            return true;
        }
    }
    
}
   

    function GetData(LinkButton)
    {
        //__doPostBack(LinkButton,'');
        document.getElementById(LinkButton).click();
     }
      
