/*
* COMMUNICATION: AS to JS
*/
	// Nav  /////////////////////////////////////////////////////////////////////////
				function onNavItemSelected(item) 
				{
					switch (item)
					{
						case "STUDIO":
							window.location = "./index.aspx";
							break;
						case "ACCESSORIES":
							window.location = "./Accessories.aspx";
							break;
					}
				}
				
	// Share /////////////////////////////////////////////////////////////////////////

				function onShare() 
				{
                    window.open('http://www.sharethis.com/','sharer','toolbar=0,status=0,width=200,height=400');
				}

    // Tracking /////////////////////////////////////////////////////////////////////////
    
                function et_eC_Wrapper4Flash(msg) {
                    et_eC_Wrapper(et_id, "zoflash", msg);
                }
				
	// Trace /////////////////////////////////////////////////////////////////////////

				function jsTrace(str) {
					alert(str);
				}
				
	// Trace /////////////////////////////////////////////////////////////////////////

				function scrollToTop() 
				{
					setTimeout('doScrollToTop()', 500); // 100 milliseconds
				}
				function doScrollToTop()
				{
					//scroll(0,0);
					scrollTo(0,0);
					
					//alert("scroll To Top");
					
					//scrollToTopAnim();
				}

				function scrollToTopAnim() 
				{
					var vscroll = (document.all ? document.scrollTop : window.pageYOffset);
					
					if (vscroll > 10) 
					{
						window.scrollBy(0, -50); // horizontal and vertical scroll increments
						scrolldelay = setTimeout('scrollToTopAnim()', 10); // scrolls every 100 milliseconds
					}
					else
					{
						window.scrollTo(0,0)
					}
				}				
				

/*
* COMMUNICATION: JS to AS
*/		
	// doSomeFlashFunction /////////////////////////////////////////////////////////////////////////

				function doSomeFlashFunction() {
					var obj = document.getElementById("my_flash");
					if (obj && typeof obj.doSomeFlashFunction != "undefined")
						obj.doSomeFlashFunction();
				}
				
				var scrollDetectionIntervalId;
				
				function startScrollDetection() {
					/*
					if (window.addEventListener)
						window.addEventListener('DOMMouseScroll', sendScrollPosition, false);
						window.onmousewheel = document.onmousewheel = sendScrollPosition;
					*/
					scrollDetectionIntervalId = setInterval(sendScrollPosition, 100);
					sendScrollPosition();
				}

				function stopScrollDetection() {
					/*
					if (window.addEventListener)
						window.removeEventListener('DOMMouseScroll', sendScrollPosition, false);
						window.onmousewheel = document.onmousewheel = null;
					*/
					clearInterval(scrollDetectionIntervalId);
				}
				
				function sendScrollPosition(e) {
					var obj = document.getElementById("my_flash");
					if (obj && typeof obj.onScrollEvent != "undefined") {
						obj.onScrollEvent(f_scrollTop()/* / (swffit.getValueOf('minHei') - f_clientHeight())*/, f_clientHeight());
					} else {
						alert("no scroll event function in flash");
					}
				}
				
				
	// AJAX /////////////////////////////////////////////////////////////////////////
			    function getVbleFromURI(vName, uri) {
		            var objParams = new Object();

		            // Use the String::replace method to iterate over each
		            // name-value pair in the query string. Location.search
		            // gives us the query string (if it exists).
		            uri.replace(
                        new RegExp("([^?=&]+)(=([^&]*))?", "g"),

		            // For each matched query string pair, add that
		            // pair to the URL struct using the pre-equals
		            // value as the key.
                        function($0, $1, $2, $3) {
                            objParams[$1] = $3;
                        }
                    );

		            return objParams[vName];
		        };
				function getVble(vName)
				{
					return getVbleFromURI(vName, document.location.search);
				}

				// GET SCROLL POSITION
				function f_clientWidth() {
					return f_filterResults (
						window.innerWidth ? window.innerWidth : 0,
						document.documentElement ? document.documentElement.clientWidth : 0,
						document.body ? document.body.clientWidth : 0
					);
				}
				function f_clientHeight() {
					return f_filterResults (
						window.innerHeight ? window.innerHeight : 0,
						document.documentElement ? document.documentElement.clientHeight : 0,
						document.body ? document.body.clientHeight : 0
					);
				}
				function f_scrollLeft() {
					return f_filterResults (
						window.pageXOffset ? window.pageXOffset : 0,
						document.documentElement ? document.documentElement.scrollLeft : 0,
						document.body ? document.body.scrollLeft : 0
					);
				}
				function f_scrollTop() {
					return f_filterResults (
						window.pageYOffset ? window.pageYOffset : 0,
						document.documentElement ? document.documentElement.scrollTop : 0,
						document.body ? document.body.scrollTop : 0
					);
				}
				function f_filterResults(n_win, n_docel, n_body) {
					var n_result = n_win ? n_win : 0;
					if (n_docel && (!n_result || (n_result > n_docel)))
						n_result = n_docel;
					return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
				}

				function popWindow(winURL, winName, winWidth, winHeight, winScroll, resizable, toolbar, directories, status, menuBar) {
					/***********************************************************
					Description: Pops window in the center of client's screen.
					************************************************************/
					if( menuBar == '' ) {
						menuBar = 0;
					}
					if( status == '' ) {
						status = 0;
					}
					if( directories == '' ) {
						directories = 0;
					}
					if( toolbar == '' ) {
						toolbar = 0;
					}
					if( resizable == '' ) {
						resizable = 0;
					}
					if(winScroll == '') {
						winScroll = 0;
					}
					if(winWidth == '') {
						winWidth = 800;
					}
					if(winHeight == '') {
						winHeight = 600;
					}
					if(winName == '') {
						winName == 'NewWindow';
					}
					var winLeft = (screen.width - winWidth) / 2;
					var winTop = (screen.height - winHeight) / 2;
					var winProps = 'height='+winHeight+',width='+ winWidth+',top='+winTop+',left='+winLeft+',scrollBars='+winScroll+',resizable='+resizable+',toolbar='+toolbar+',directories='+directories+',status='+status+',menuBar='+menuBar;
					var win = window.open(winURL, winName, winProps);
				}
