﻿// JScript File

//jquery

// This is the hack for IE




$(document).ready(function() {


    if ($.browser.msie) {
        $('input:radio').click(function() {
            this.blur();
            this.focus();
        });
    }
    
    /*
    $("input:radio").mouseup(function() {
        if ($(this).attr('checked') == true)           
           $(this).attr('checked', false);                
    });
    */
    

    $("div[parentId]").hide();

    $("input:radio:checked").each(function() {

        if ($(this).attr('id').indexOf('_answer_') != -1) {

            
            var parentId = this.id.substr(42, 13); 

            $("div[parentId='" + parentId + "']").show();

        }
        // slideDown("fast"); 
    });

    
    $("input:radio").change(function() {
    
    
     if ($(this).attr('id').indexOf('_answer_') != -1)
     {
            
            $("div[parentId]").hide();
            
            $("input:radio:checked").each(function() {
            
            
            
            var parentId = this.id.substr(42, 13); 
                        
 
                        
            $("div[parentId='" + parentId + "']").show();
            
            });
            
            var parentId = this.id.substr(42, 13); 
                       
            if($(this).attr('id').indexOf(parentId) != -1)
            {
                $("div[parentId='" + parentId + "']").find("input:radio").attr('checked', false);
                $("div[parentId='" + parentId + "']").find("input:checkbox").attr('checked', false);
            }
            
            
            
            
   
    }


    });
    
    


});



/*
$(document).ready(function() {    
    $('span').hoverbox();
});
*/



function PrintOnlyAlert() {
    alert('You can only print this page, but not change it!');
    return false;
}

// JScript File

        var current_action = 'navigation';        
        

        /* script para detectar si el documento se ha modificado */
        
        function processSave()
        {
            current_action = 'saving';
            return true;
        }
        
        function processClose()
        {
            // current_action = 'saving';
            return true;
        }

        function doPrintDoc()
        {
            current_action = 'printing';
            
            // alert("Printing will be available soon!");
            var url;
            var win;
            
            url = '../Print/Print.aspx';
                
            win = window.open(url,'Art15','width=750,height=500,status=yes,resizable=yes, scrollbars=yes');
            win.focus();    
            return false;
        }

        function doPrintDocId(obj)
        {
            current_action = 'printing';
            
            // alert("Printing will be available soon!");
            var url;
            var win;
            
            url = '../Print/PrePrint.aspx?PlayerId=' + obj;
                
            win = window.open(url,'Art15','width=750,height=500,status=yes,resizable=yes, scrollbars=yes');
            win.focus();    
            return false;
        }
                
        function processDelete()
        {
            current_action = 'deleting';
            return true;
        }
        
        function processChange()
        {
            current_action = 'changing';
            return true;
        }
        
        function form_changed(obj)
        {
   		    var el, opt, hasDefault; 
   		    var i = 0;
   		    var j;
   		    while(el = obj.elements[i++])
   		    {
   			    switch (el.type)
   			    {
   				    case 'text' :
   				    case 'textarea' :
   				        /*case 'hidden' :*/
   				        //alert('text');
     				    if (el.value != el.defaultValue) return true;
     				    break;
     			    case 'checkbox':
     			    case 'radio':
     			        //alert('radio');
     			        if (el.checked != el.defaultChecked) return true;
     			        break;
     			    //case 'select-one':     			        
     			    //    for (var i = 0; i < el.length; i++)
     			    //        if (el.options[i].selected != el.options[i].defaultSelected) return true;
     			    //    break;			   				
   			    }
   		    }
   		    return false;   
        }
  
  
        function info_changes()
        {      
            if (current_action == "navigation")
  		        if(form_changed(document.forms[0]))	
  		            if (confirm('Do you want to save the changes you made ?'))
  		            //if (!confirm('Are you sure you wish to continue without saving the changes?'))
  		            {       
  		                    //__doPostBack('btnSave', '');
  		                    __doPostBack('ctl00$ContentPlaceHolder1$btnSave', '');
  		                    // ctl00$ContentPlaceHolder1$btnSave
  		                    return false;
  		                    
  		                    // WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$btnSave","", true, "", "", false, false));
  		                    //alert(document.forms[0].__EVENTTARGET.value); 
                            //alert(document.forms[0].__EVENTARGUMENT.value);  		            
  		            }
  		    
  		    return true;         
        }


        /* script para el mensages al usuario */
        function init()
        {
            if (window.msg) 
                msg();     
            return true;
        }
    
        function doHourglass(value)
        {
            document.body.style.cursor = value;
        }

    
       


        /* script para gestionar el estado de los controles del formulario */
    
	    function processCheck(obj)
	    {
	        var root = obj;
		    var node = obj.parentNode;

		    while(node.tagName.toLowerCase() != 'div')
                node = node.parentNode;

		    parserFrom(node);
		    
		    conditional_answer(obj);
		
		    return true;
	    }
	
	    function parserFrom(obj)
	    {
	        var root = obj;
	    
 	        if (root.tagName == 'INPUT')
  	        if (root.type.toString() == 'text')
  	          	root.disabled = false;
  	          	 
	        if (root.tagName == 'TEXTAREA')
	            root.disabled = false;           	       
	    
     	    for (var i = 0; i < root.childNodes.length; i++)
		    {
		        var node = root.childNodes[i];
			    parserFrom(node);
		    }		
		    return true;		
	    }


        function doPrintDocA(obj)
	    {
	    	        
     	    //alert("Printing will be available soon!");
	        current_action = 'printing';           
            
            var win;            
            var url = 'PrintA.aspx?rev='+ obj;
            
            win = window.open(url,'Pint_A','width=700,height=500,status=yes,resizable=yes, scrollbars=yes');
            win.focus();    
            return false;
	    }
	    
        function doPrintDocB(obj)
	    {
	    	        
     	    //alert("Printing will be available soon!");
	        current_action = 'printing';           
            var win;            
            var url = 'PrintB.aspx?rev='+ obj;
            win = window.open(url,'Print_B','width=700,height=500,status=yes,resizable=yes, scrollbars=yes');
            win.focus();    
            return false;
	    }
	    
	    function doPrintDocC(obj)
	    {
	    	        
     	    alert("Printing will be available soon!");
     	    return false;
     	    
	        /*current_action = 'printing';           
            var win;            
            var url = 'PrintC.aspx?rev='+ obj;
            win = window.open(url,'Print_C','width=700,height=500,status=yes,resizable=yes, scrollbars=yes');
            win.focus();    
            return false;
            */
	    }
	    
	 
