   function detectOS()
  {
   if(navigator.userAgent.indexOf('Linux') != -1)
     { var OpSys = "Linux"; }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 6.1') != -1))
     { if (navigator.userAgent.indexOf('64') != -1){ var OpSys = "Windows 7 64-Bit";}
       else{var OpSys = "Windows 7";}}
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 6.0') != -1))
     { if (navigator.userAgent.indexOf('64') != -1){var OpSys = "Windows Vista 64-Bit";}
	   else{var OpSys = "Windows Vista";} }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 5.2') != -1))
     {var OpSys = "Windows XP 64-Bit";}		 
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 5.1') != -1))
     { var OpSys = "Windows XP"; }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 5.0') != -1))
     { var OpSys = "Windows 2000"; }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT 4.0') != -1))
     { var OpSys = "Windows NT 4.0"; }	
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('9x') != -1))
     { var OpSys = "Windows ME"; }	 
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('98') != -1))
     { var OpSys = "Windows 98"; }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('95') != -1))
     { var OpSys = "Windows 95"; }
   else if(navigator.userAgent.indexOf('Mac OS') != -1)   
     { if (navigator.userAgent.indexOf("Intel")!=-1) var OpSys = "Mac OS X - Intel";
	   if (navigator.userAgent.indexOf("PPC")!=-1) var OpSys = "Mac OS X - PowerPC";
	   }	  
   else { var OpSys = "Others"; }
   return OpSys;
		   }
		   
		   function correctOS()
		   {
		   var os = detectOS();		   
		   $("#OsSelection").children().each( function()
			 {
	         if ($(this).attr('value') == os) $(this).attr('selected','selected');
			 }); 
           jQuery( 'select.jsOSDropdown' ).each( function() { var dropdown = this; setTimeout( function() { new Epson.GenericDropdown( dropdown ) }, 1 ) } );
           //adjust drivers accordingly
		   var flag="NO";
		   jQuery( '#Drivers .osgroup' ).each( function()
			 {
	         if (jQuery(this).attr('id') == os) flag="YES";	         
			 }); 
		   if (flag=="YES") 
		   {
		    jQuery( '#Drivers .osgroup' ).each( function()
			 {
	         if (jQuery(this).attr('id') != os) jQuery(this).hide();	         
			 });           	
            } 
		   }
		   
		   //tab switcher
           function initalVisibleState1()
           {
           document.getElementById("overview").style.visibility="visible";
		   document.getElementById("overview").style.display="";
           document.getElementById("techSpecs").style.display="none";
		   document.getElementById("inksAccessories").style.display="none";
		   document.getElementById("driversSupport").style.display="none";
           }
		   function initalVisibleState2()
           {		   
           document.getElementById("techSpecs").style.visibility="visible";
		   document.getElementById("techSpecs").style.display="";
		   document.getElementById("overview").style.display="none";
		   document.getElementById("inksAccessories").style.display="none";
           document.getElementById("driversSupport").style.display="none"; 
           }
		   function initalVisibleState3()
           {
           document.getElementById("inksAccessories").style.visibility="visible";
		   document.getElementById("inksAccessories").style.display="";
           document.getElementById("techSpecs").style.display="none";
           document.getElementById("overview").style.display="none";
           document.getElementById("driversSupport").style.display="none";
           }
		   function initalVisibleState4()
           {		   
           document.getElementById("driversSupport").style.visibility="visible";
		   document.getElementById("driversSupport").style.display="";
           document.getElementById("techSpecs").style.display="none";
           document.getElementById("inksAccessories").style.display="none";
           document.getElementById("overview").style.display="none";
		   correctOS();
           }
		   //hide tabes
		   function hideTechspecsTab()
		   {
		   jQuery('.techspecs').hide();
		   jQuery('#techSpecs').hide();
		   }
		   function hideAccessoryTab()
		   {
		   jQuery('.accessory').hide();
		   jQuery('#inksAccessories').hide();		   
		   }
		   function hideDriverTab()
		   {
		   jQuery('.driver').hide();
		   jQuery('#driversSupport').hide();		   
		   }
           //invalid product redirect		   
		   function errorRedirect()
		   {
		   window.location.href="$PAGE_LINK[error]";
		   }
           //print triger
           function printpage()
           {
	       if (window.print){window.print();}
	       else{alert("Sorry, your browser doesn't support this feature.");}
           }
           //os filter
           function osSwitch(value)
           {
           jQuery( '#Drivers .osgroup' ).each( function()
	       {
	        if (jQuery(this).attr('id') == value){jQuery(this).show();}			 
	        else{jQuery(this).hide();}     
	       });  
           }
           //popup close
           function close(e)
           {
	        jQuery ( '#Popup' ).remove();
	        jQuery( '#PopupBackground' ).remove();
	        if (jQuery.browser.msie) if (e) e.preventDefault();	
           }
		   
//popup video		   
	    function videoClose(e)
	    {
		jQuery( '#NuggetLayer' ).animate( { opacity:0 }, 300, 'swing', function() { jQuery( '#NuggetLayer' ).remove() } );
		
        e.preventDefault();
	    }

		function triggerPopupVideo(source,name)
		{				
		var videoSource = '../../..' + source ;

		var content = '<div class="nuggetVideo"><div class="nuggetArticleContent" style="margin-left: 0pt;">';

		//setTimeout("swfobject.embedSWF('../../../resource/singapore/product_videos/inkjet/T60/B_Rotation.swf', 'FlashNuggetVideoPlayer', '585', '329', '9.0.0')",1000);
		
		//var swfobj = "swfobject.embedSWF('" + videoSource + "', 'FlashNuggetVideoPlayer', '585', '329', '9.0.0')";
		
		setTimeout("swfobject.embedSWF('" + videoSource + "', 'FlashNuggetVideoPlayer', '585', '329', '9.0.0')",1000);
		
        content += '<div id="FlashNuggetVideoPlayer"></div>';
		    		
        content += '<div class="nuggetVideoContent">' + '<h1>' + name + '</h1></div></div></div>';

        var nugget_layer_content = '<div id="NuggetLayer" class="nuggetGalleryLayer">' + content + '</div>';

		var nugget_layer = jQuery( nugget_layer_content ).css( { height:0, width:0, margin:0, opacity:0 } );		

		jQuery( '#product' ).append( nugget_layer );
		
		jQuery('#NuggetLayer').append(jQuery( '<div class="close"><a href="#" class="buttonBlueClose"><span>Close</span></a></div>') );
		
		jQuery( '#NuggetLayer .close' ).bind( 'click', videoClose );		

		nugget_layer.animate( { height:480, width:940, marginTop:-241, marginLeft:-470, opacity:1 }, 500, 'swing' );
	
		}
		
		function retrieveDownload()
		{
		var file = jQuery('#Agree').attr('name');
        close();		
		window.location.href = file;
		}
		
		function triggerPopupDownload(driverUrl, driverSize)
		{		
		
		var title = "Download";
		
		var content="";
		
        content += '<form id="DownloadForm" method="post" class="popupForm" action="#">';
		
		content += '<h4>End User Software License Agreement</h4>'; 
		
		content += '<fieldset><div class="formItem clearfix"><div class="fi_content"><div cols="35" rows="10" id="f_dl_privacypolicy">'; 
  
        content += '<p><strong>Notice to User:</strong> This is a legal agreement between you (an individual or single entity, referred to hereinafter as "you") and Epson Singapore Pte Ltd, Inc. ("Epson") for computer software product, fontware, typefaces and/or data, including any accompanying explanatory written materials (the "Software"). BEFORE INSTALLING, COPYING OR OTHERWISE USING THE SOFTWARE, YOU MUST AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. If you agree, click on the Accept button below. If you do not agree with the terms and conditions of this Agreement, click on the Decline button and you will not be able to download the Software.</p>'; 
 
        content += '<p><strong>License.</strong> Epson grants you a personal, nonexclusive, limited license to install and use the Software. You may also make copies of the Software as necessary for backup and archival purposes. The term Software shall include the software components, media, all copies made by you and any upgrades, modified versions, updates, additions and copies of the Software licensed to you by Epson or its suppliers. Epson and its suppliers reserve all rights not granted.</p>'; 
 
        content += '<p><strong>Other Rights and Limitations.</strong> The Software is licensed as a single unit, and its component programs may not be separated. You agree not to modify, adapt or translate the Software. You further agree not to attempt to reverse engineer, decompile, disassemble or otherwise attempt to discover the source code of the Software. You may not rent, lease, distribute, sublicense or lend the Software to third parties. You may, however, transfer all your rights to use the Software to another person or legal entity provided that you transfer this Agreement, the Software, including all copies, updates and prior versions, to such person or entity, and that you retain no copies, including copies stored on a computer. Further, you agree not to place the Software onto a server so it is accessible via a public network such as the Internet or an intranet.</p>'; 
 
        content += '<p><strong>Ownership.</strong> Title, ownership rights, and intellectual property rights in and to the Software shall remain with Epson or its suppliers. The Software is protected by copyright law as set out in the Singapore Copyright Act (Cap. 63) and international copyright treaties, as well as other intellectual property laws and treaties. There is no transfer to you of any title to or ownership of the Software and this License shall not be construed as a sale of any rights in the Software. You agree not to remove or alter any copyright, trademark, registered mark or other proprietary notices on any copies of the Software. Epson and its suppliers reserve all rights not granted.</p>'; 
 
        content += '<p><strong>Warranty Disclaimers.</strong> You acknowledge and agree that the use of the Software is at your own risk. THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY WARRANTY OF ANY KIND. EPSON AND ITS SUPPLIERS DO NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE. EPSON AND ITS SUPPLIERS MAKE NO WARRANTIES, EXPRESS OR IMPLIED, AS TO NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Because some states and jurisdictions do not allow the exclusion or limitation of implied warranties in certain circumstances, the above limitations may not apply to you.</p>';
 
        content += '<p><strong>Limitation of Liability.</strong> IN NO EVENT WILL EPSON OR ITS SUPPLIERS BE LIABLE TO YOU, WHETHER ARISING UNDER CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, BREACH OR WARRANTY, MISREPRESENTATION OR OTHERWISE, FOR ANY DIRECT, CONSEQUENTIAL, INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS OR LOST SAVINGS, EVEN IF EPSON, ITS SUPPLIERS OR ANY REPRESENTATIVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY THIRD PARTY. In no event shall Epson,s liability for any damages, regardless of the nature of the claim, exceed the amount paid by you for the Software or ten dollars ($10.00) whichever is greater. Because some states and jurisdictions do not allow the exclusion or limitation of liability in certain circumstances, the above limitation may not apply to you.</p>'; 
 
        content += '<p><strong>Termination.</strong> Without prejudice to any other rights Epson has, this Agreement shall automatically terminate upon failure by you to comply with its terms. You may also terminate this Agreement at any time by destroying the Software and all copies.</p>'; 
 
        content += '<p><strong>Governing Law and General Provisions.</strong> This Agreement shall be governed and construed under the laws of the Republic of Singapore, without regard to its conflicts of law rules. This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods, the application of which is expressly excluded. This Agreement is the entire agreement between the parties related to the Software supersedes any purchase order, communication, advertisement, or representation concerning the Software. This Agreement shall be binding upon, and inure to the benefit of, the parties hereto and their respective successors, assigns and legal representatives. If any provision herein is found void or unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. This Agreement may only be modified in writing signed by an authorized officer of Epson.</p>';  
 
        content += '<p>Copyright© 2009 Epson Singapore Pte Ltd</p>';
		
		content += '</div></div></div></fieldset>';
		
//<div class="formItem fi2 clearfix"><div class="fi_content"><input type="checkbox" id="f_dl_privacy" name="privacyPolicy" value="true"/><label for="f_dl_privacy">I accept the privacy policy</label></div></div>

        content += '<div class="formButtons"><strong class="buttonBlue"><input type="button" name="' + driverUrl + '" class="buttonDownload" id="Agree" value="I Agree"/></strong><a id="Cancel" class="button closePopup" href="#"><span>Cancel</span></a></div></form>';
		
		var popupElement = jQuery( '<div id="Popup" class="genericRoundedCorners genericPopup"><div class="header"><div class="headerContent"><p>' + title + '</p><div class="closeButton"><a href="#" class="buttonBlueClose"><span>close</span></a></div></div></div><div class="content clearfix">' + content + '</div><div class="bottom"><div class="bl"></div><div class="br"></div><div class="b"></div></div></div>' );

		popupElement.find( '.closeButton a' ).bind( 'click', close );

        popupElement.find( '#Cancel' ).bind( 'click', close );
		
		popupElement.find( '#Agree' ).bind( 'click', retrieveDownload );

//		jQuery( '#DownloadForm' ).bind( 'submit', checkAgreement );	
		
		jQuery ( '#container' ).append( popupElement );
		
		var positions = ( jQuery( window ).height() / 2 ) - ( popupElement.height() / 2 );

		jQuery('#Popup').css( { top:positions+'px' } );

		if ( jQuery.browser.msie && parseInt( jQuery.browser.version ) == 6 ) jQuery( window ).bind( 'scroll', position );

		// render backdrop
		jQuery ( '#container' ).append( jQuery( '<div id="PopupBackground"></div>' ).css( { width:jQuery( window ).width()+'px', height:jQuery( window ).height()+'px' } ) );
		
		// set up window resize event to reposition popup
		//jQuery( window ).bind( 'resize', position );	
		}	

        function position()	
		{
		var positions = ( jQuery( window ).height() / 2 ) - ( jQuery('#Popup').height() / 2 );
		if ( jQuery.browser.msie && parseInt( jQuery.browser.version ) == 6 ) positions += document.documentElement.scrollTop;
		jQuery('#Popup').css( { top:positions+'px' } );		
		jQuery ( '#PopupBackground' ).css( { top:document.documentElement.scrollTop+'px' } );
		jQuery ( '#PopupBackground' ).css( { width:jQuery( window ).width()+'px', height:jQuery( window ).height()+'px' } );
		}	
		
