﻿//function PrintContent(ctrl)
//    {
//        //alert(ctrl);
//        var DocumentContainer = document.getElementById(ctrl);
//      
//        WindowObject = window.open ("", "mywindow","location=1,status=1,scrollbars=1,width=100,height=100");
//          
//        //alert(ctrl);
//        //alert(DocumentContainer);
//        
//        WindowObject.document.write('<style type="text/css">');
//        WindowObject.document.write('body {margin:5px auto;padding:10px;font-family:arial;}' );
//        WindowObject.document.write('</style>');
//        // WindowObject.document.write('<link href="../style/internal.css" rel="stylesheet" type="text/css" />' );
//        WindowObject.document.write('<link href="../style/Editorstyle.css" rel="stylesheet" type="text/css" />' );
//        WindowObject.document.write(DocumentContainer.innerHTML);
//        //alert(DocumentContainer.innerHTML);
//        //alert(ctrl);
//       // WindowObject.document.close();
//        WindowObject.focus();
//        WindowObject.print();
//        WindowObject.close();
//    }
//    
    
    function PrintContent(ctrl,logoImg)
    {
        try
        {
            var TableID=document.getElementById(ctrl);
            var PrintWindow=window.open("","","SCROLLBARS=YES,WIDTH=700,HEIGHT=700,LEFT=10,TOP=10,RESIZABLE=YES");
            var PrintStyles="body {margin:5px auto;padding:10px;font-family:arial;}";
            PrintWindow.document.open();
            PrintWindow.document.write("<html>");
            PrintWindow.document.write('<head><title>Print Page</title><link href="../style/Editorstyle.css" rel="stylesheet" type="text/css" /><style>'+PrintStyles+'</style>');

            PrintWindow.document.write("</head><body>");
            PrintWindow.document.write("<center><img border=\"0px\" src=\"/image/printlogos/"+logoImg+"\"></center>");
            
            PrintWindow.document.write("<br>");
            PrintWindow.document.write(TableID.innerHTML);

            PrintWindow.document.write("</body>");
            PrintWindow.document.write("</html>");
            //Print won't work without close()
            PrintWindow.focus();
            PrintWindow.print()
            PrintWindow.document.close();
            PrintWindow.close();
        }
        catch(e)
            {
            alert(e);
            }
        } 

    function SetFavourite()
    {
      if(document.all)
      window.external.AddFavorite(location.href,document.title);
      else if(window.sidebar)
      window.sidebar.addPanel(document.title,location.href,'');
    }
    
     //Popup
     function showPopUp(name, state,srcVal)
    {
    alert('sad');
         var popups = document.getElementById(name);
         var container= document.getElementById("container_global");
         var frame= document.getElementById("frm");
         myPopupRelocate(popups);
         frame.src=srcVal;
            if ( popups.getAttribute("id") == name )
            {
               if(state==1)
               {
                    setOpacity(container,10);
                }
                else
                {
                     setOpacity(container,10);
                }
                popups.style.display = (state == 1)?'block':'none';
            }
            else
            {
                popups.style.display = 'none';
            }
        
    }
    
    function myPopupRelocate(obj) {
     var scrolledX, scrolledY;
     if( self.pageYOffset ) {
       scrolledX = self.pageXOffset;
       scrolledY = self.pageYOffset;
     } else if( document.documentElement && document.documentElement.scrollTop ) {
       scrolledX = document.documentElement.scrollLeft;
       scrolledY = document.documentElement.scrollTop;
     } else if( document.body ) {
       scrolledX = document.body.scrollLeft;
       scrolledY = document.body.scrollTop;
     }

     var centerX, centerY;
     if( self.innerHeight ) {
       centerX = self.innerWidth;
       centerY = self.innerHeight;
     } else if( document.documentElement && document.documentElement.clientHeight ) {
       centerX = document.documentElement.clientWidth;
       centerY = document.documentElement.clientHeight;
     } else if( document.body ) {
       centerX = document.body.clientWidth;
       centerY = document.body.clientHeight;
     }

     var leftOffset = scrolledX + (centerX - 250) /2;
     var topOffset = scrolledY + (centerY +200) /3;

     obj.style.top = topOffset-400 + "px";
     obj.style.left = leftOffset + "px";
    }
    function setOpacity(popups,value) 
    {
	    popups.style.opacity = value/10;
	    popups.style.filter = 'alpha(opacity=' + value*10 + ')';
    }
    function setPosition(obj)
    {
//        x = event.clientX + document.body.scrollLeft; // get the mouse left position
//		y = event.clientY + document.body.scrollTop + 35; // get the mouse top position 
	    obj.style.display="block"; // display the pop-up
		obj.style.left = 300; // set the pop-up's left
		obj.style.top =200 // set the pop-up's top
        
        
    }
    
    

    function hideDv(hidepopUp, popup)
    {
      var popupVar=document.getElementById(popup);
      var hpopup=document.getElementById(hidepopUp);
      hpopup.style.display = 'none';
      setOpacity(popupVar,10);
    }
    //End popup

 //Start function for submit function

function noPostBack(strPagePath)
{
    
    document.forms[0].action =strPagePath;
    document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
    return true;
}

 //End function for submit function
   
    