// Global JS Document - Matsiyah Design Studio - www.matsiyah.com
<!--
		function getURLdata(){
			
				var serdar = window.location.search.indexOf('?');
				var efendim = window.location.search.substring(serdar+1, window.location.search.length);
				
				return efendim;
				
			}
			
function pageLoad(){
			
			var strURLdata = getURLdata();
			if(!strURLdata){
					//checkSidebar();
					getList('100', '1');
					tabChange2('tab_div_1');
				}else{
					
					if(strURLdata == 'complete'){
						//checkSidebar();
						completeOrder();
						document.getElementById('product_list').style.width="880px";
						document.getElementById('sidebar').style.display = "none";
						
					}else if(strURLdata.slice(0,3) == 'cat'){
							//checkSidebar();
							tabChange2('tab_div_'+strURLdata.slice(3,4));
							getList('100', strURLdata.slice(3,4));
							document.getElementById('product_list').style.width="880px";
							document.getElementById('sidebar').style.display = "none";
					
					}else if(strURLdata.slice(0,1) == 'c' && strURLdata.slice(2,3) == 'p'){
							//checkSidebar();
							tabChange2('tab_div_'+strURLdata.slice(1,2));
							getDetails(strURLdata.slice(3,10));
							document.getElementById('product_list').style.width="1000px";
							document.getElementById('sidebar').style.display = "";
					}else{
						//checkSidebar();
						getList('100', '1');
						tabChange2('tab_div_1');	
					}	
				}
			}
			


		function cPageLoad(){
			
			var strURLdata = getURLdata();
			if(!strURLdata){
						getContentPage('about');
						changeMenuContent('about');
						
						document.getElementById('page_header').innerHTML = '<img id="page_title" src="../i/p_en_1.png" width="287" height="72" style=" float:right; margin:0px 15px 0px 0px;" />';
						
						
				}else{
					if(strURLdata == 'about'){
						
						getContentPage('about');
						changeMenuContent('about');
						
						document.getElementById('page_header').innerHTML = '<img id="page_title" src="../i/p_en_1.png" width="287" height="72" style=" float:right; margin:0px 15px 0px 0px;" />';
						
						}
					
					else if(strURLdata == 'quality'){
						
						getContentPage('quality');
						changeMenuContent('quality');
						
						document.getElementById('page_header').innerHTML = '<img id="page_title" src="../i/p_en_3.png" width="287" height="72" style=" float:right; margin:0px 15px 0px 0px;" />';
						
						
						}
					
					else if(strURLdata == 'contact'){
						
						getContentPage('contact');
						changeMenuContent('contact');
						
						document.getElementById('page_header').innerHTML = '<img id="page_title" src="../i/p_en_4.png" width="287" height="72" style=" float:right; margin:0px 15px 0px 0px;" />';
						
						}
					else {
						
						getContentPage('about');
						changeMenuContent('about');
						
						document.getElementById('page_header').innerHTML = '<img id="page_title" src="../i/p_en_1.png" width="287" height="72" style=" float:right; margin:0px 15px 0px 0px;" />';
						
						}
						
					}	
			
			}

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//AJAX FUNCTIONS/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
				
				//GLOBAL AJAX FUNCTIONS///////////////////////////////////////////////////////////////////////////////////////////////////////////////
				//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
					function nesneyarat() {
						var nesne;
						var tarayici = navigator.appName;
						if(tarayici == "Microsoft Internet Explorer"){
							nesne = new ActiveXObject("Microsoft.XMLHTTP");
						}else{
							nesne = new XMLHttpRequest();
						}
						return nesne;
					}
							 
					var http1 = nesneyarat();
					var http2 = nesneyarat();
					var http3 = nesneyarat();
					var http4 = nesneyarat();
					var http5 = nesneyarat();
					var http6 = nesneyarat();
					var http7 = nesneyarat();
					var http8 = nesneyarat();
					var http9 = nesneyarat();
					var http10 = nesneyarat();
					var http11 = nesneyarat();
					
					function mkRandomString() { 	
						var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
						var string_length = 20;
						var randomstring = '';
						for (var i=0; i<string_length; i++) {
							var rnum = Math.floor(Math.random() * chars.length);
							randomstring += chars.substring(rnum,rnum+1);
						}
						return randomstring;		
					}
					
				//GLOBAL AJAX FUNCTIONS///////////////////////////////////////////////////////////////////////////////////////////////////////////////
				//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
				
				//CHECK SIDEBAR////////////////////////////////////////////////////////////////////////
				function checkSidebar(){
					var ms_random = mkRandomString();
					
					http1.open('get', '../get.asp?pID=300&msID=' + encodeURI(ms_random));
					http1.onreadystatechange = function(){ if (http1.readyState==4) {
							var strGoster = http1.responseText;
							if(strGoster=='goster'){
								document.getElementById('product_list').style.width="730px";
								document.getElementById('sidebar').style.display = "";
								getOrder();
								}else{
								document.getElementById('product_list').style.width="1000px";
								document.getElementById('sidebar').style.display = "none";	
								}
							}
						};
					http1.send(null);
					}	
				
				
				
				
				//GET ORDER////////////////////////////////////////////////////////////////////////
				function getOrder(){
					var ms_random = mkRandomString();
					
					http2.open('get', '../get.asp?pID=400&msID=' + encodeURI(ms_random));
					http2.onreadystatechange = function(){ if (http2.readyState==4) {
							document.getElementById('sidebar').innerHTML = http2.responseText;
							}
						};
					http2.send(null);
					}
				//GET ORDER////////////////////////////////////////////////////////////////////////
				
				
				
				
				//GET PRODUCT LIST/////////////////////////////////////////////////////////////////
				function getList(pID, catID){	
					var ms_random = mkRandomString();
					document.getElementById('product_list').innerHTML = "";
					
					http3.open('get', '../get.asp?pID=' + pID + '&catID=' + catID + '&msID=' + encodeURI(ms_random));
					http3.onreadystatechange = function(){ if (http3.readyState==4) { 
						document.getElementById('loader').style.display = "none";
						document.getElementById('product_list').innerHTML = http3.responseText;
						}else{
							document.getElementById('loader').style.display = "";	
						}
						
						};
					http3.send(null);
					}
				//GET PRODUCT LIST/////////////////////////////////////////////////////////////////
				

				//GET PRODUCT LIST FOR MAIN PAGE/////////////////////////////////////////////////////////////////
				function getListForMain(catID){	
					var ms_random = mkRandomString();
					document.getElementById('main_tab_content').innerHTML = "";
					
					http11.open('get', 'get.asp?pID=1500&catID=' + catID + '&msID=' + encodeURI(ms_random));
					http11.onreadystatechange = function(){ if (http11.readyState==4) { 
						document.getElementById('loader').style.display = "none";
						document.getElementById('main_tab_content').innerHTML = http11.responseText;
						}else{
							document.getElementById('loader').style.display = "";	
						}
						
						};
					http11.send(null);
					}
				//GET PRODUCT LIST FOR MAIN PAGE/////////////////////////////////////////////////////////////////
				
				
				//GET PRODUCT DETAILS//////////////////////////////////////////////////////////////
				function getDetails(productID){	
					var ms_random = mkRandomString();
					document.getElementById('product_list').innerHTML = "";
					
					http4.open('get', '../get.asp?pID=200&productID=' + productID + '&msID=' + encodeURI(ms_random));
					http4.onreadystatechange = function(){ if (http4.readyState==4) { 
						document.getElementById('loader').style.display = "none";
						document.getElementById('product_list').innerHTML = http4.responseText;
						refreshZoom()
						}else{
							document.getElementById('loader').style.display = "";
							refreshZoom()	
						}
						
						};
					http4.send(null);
					}
				//GET PRODUCT DETAILS//////////////////////////////////////////////////////////////
				
				
				
				
				//ADD TO CART//////////////////////////////////////////////////////////////////////
				function addToCart(productID, orderQuantity){
					var ms_random = mkRandomString();
					http5.open('get', '../get.asp?pID=500&productID=' + productID + '&orderQuantity=' + orderQuantity + '&msID=' + encodeURI(ms_random));
					http5.onreadystatechange = function(){ if (http5.readyState==4) { 
							checkSidebar();
							getDetails(productID);
						}
						
						};
					http5.send(null);		
					}
				//ADD TO CART//////////////////////////////////////////////////////////////////////
				
				
				
				
				//UPDATE CART//////////////////////////////////////////////////////////////////////
				function updateItem(productID, orderQuantity){
					var ms_random = mkRandomString();
					
					http6.open('get', '../get.asp?pID=600&productID=' + productID + '&orderQuantity=' + orderQuantity + '&msID=' + encodeURI(ms_random));
					http6.onreadystatechange = function(){ if (http6.readyState==4) {
							pageLoad();
							}
						};
					http6.send(null);
					}		
				//UPDATE CART//////////////////////////////////////////////////////////////////////
				
				
				
				
				//DELETE CART//////////////////////////////////////////////////////////////////////
				function deleteItem(cartID){
					var ms_random = mkRandomString();
					
					http7.open('get', '../get.asp?pID=700&cartID=' + cartID + '&msID=' + encodeURI(ms_random));
					http7.onreadystatechange = function(){ if (http7.readyState==4) {
							pageLoad();
							}
						};
					http7.send(null);
					}	
				//DELETE CART//////////////////////////////////////////////////////////////////////
				



				//COMPLETE CART//////////////////////////////////////////////////////////////////////
				function completeOrder(){
					var ms_random = mkRandomString();
					//document.getElementById('product_list').innerHTML = "";
					
					http10.open('get', '../get.asp?pID=800&msID=' + encodeURI(ms_random));
					http10.onreadystatechange = function(){ if (http10.readyState==4) { 
							document.getElementById('loader').style.display = "none";
							document.getElementById('product_list').style.width="1000px";
							document.getElementById('sidebar').style.display = "none";	
							document.getElementById('product_list').innerHTML = http10.responseText;
						}else{
							document.getElementById('loader').style.display = "";	
						}
						
						};
					http10.send(null);
					}	
				//COMPLETE CART//////////////////////////////////////////////////////////////////////
				
				
								
				
				//GET CONTENT PAGE CONTENT he he he=) ////////////////////////////////////////////
				function getContentPage(who){
					
					var ms_random = mkRandomString();
					
					changeMenuContent(who);
					
					http8.open('get', '../get.asp?pID=1100&pageName=' + who + '&msID=' + encodeURI(ms_random));
					http8.onreadystatechange = function(){ if (http8.readyState==4) {
							
							document.getElementById('cPageContent').innerHTML = http8.responseText;
							
							}
						};
					http8.send(null);
					}					
				//GET CONTENT PAGE CONTENT he he he=) ////////////////////////////////////////////
				
				
				
				
				//GET MENU CONTENT ///////////////////////////////////////////////////////////////
				function changeMenuContent(who){
					
					var ms_random = mkRandomString();
					
					http9.open('get', '../get.asp?pID=1200&pageName=' + who + '&msID=' + encodeURI(ms_random));
					http9.onreadystatechange = function(){ if (http9.readyState==4) {
							
							document.getElementById('menuContainer').innerHTML = http9.responseText;
							
								if(who == 'quality'){
									flowplayer("player", "../inc/flowplayer-3.2.7.swf", { clip: { autoPlay: true, autoBuffering: true, onBeforeFinish: function () {this.getPlugin("play").css({opacity: 0});}  }, canvas: {backgroundColor: '#FFFFFF'}, plugins: {controls: null} });
									}
							}
						};
					http9.send(null);
					}					
				//GET MENU CONTENT ///////////////////////////////////////////////////////////////
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				/////////////////////////////////////////////////////////////////////////////////////////////////////
				// SITE DESIGN FUNCTIONS
				/////////////////////////////////////////////////////////////////////////////////////////////////////
				
				
		
				function tabMouseOver(tabName, imageName){ 
						document.getElementById(tabName).src = imageName; 
						}
				
				function tabChange(tabName){
						document.getElementById('tab_div_1').style.backgroundImage = '';
						document.getElementById('tab_div_2').style.backgroundImage = '';
						document.getElementById('tab_div_3').style.backgroundImage = '';
						document.getElementById('tab_div_4').style.backgroundImage = '';
						
						document.getElementById(tabName).style.backgroundImage = 'url(i/tab_back.png)';
						}
				
				function tabChange2(tabName){
						document.getElementById('tab_div_1').style.backgroundImage = '';
						document.getElementById('tab_div_2').style.backgroundImage = '';
						document.getElementById('tab_div_3').style.backgroundImage = '';
						document.getElementById('tab_div_4').style.backgroundImage = '';
						
						document.getElementById(tabName).style.backgroundImage = 'url(../i/tab2_back.png)';
						}
				
				function menuMouseOver(menuName, xPos){
						document.getElementById(menuName).style.backgroundImage = 'url(../i/menu_hover.png)';
						document.getElementById(menuName).style.backgroundPosition = xPos + " 0";
					}
				
				function menuMouseOut(menuName, xPos){
						document.getElementById(menuName).style.backgroundImage = 'url(../i/menu.png)';
						document.getElementById(menuName).style.backgroundPosition = xPos + " 0";
					}


				function menuMouseOver2(menuName, xPos){
						document.getElementById(menuName).style.backgroundImage = 'url(i/menu_hover.png)';
						document.getElementById(menuName).style.backgroundPosition = xPos + " 0";
					}
				
				function menuMouseOut2(menuName, xPos){
						document.getElementById(menuName).style.backgroundImage = 'url(i/menu.png)';
						document.getElementById(menuName).style.backgroundPosition = xPos + " 0";
					}

				
				function isNumberKey(evt){
						 var charCode = (evt.which) ? evt.which : event.keyCode
						 if (charCode > 31 && (charCode < 48 || charCode > 57))
							return false;
				
						 return true;
					}
				
				function checkItemNumber(txtBox){
					
					var txtBoxName = document.getElementById(txtBox).value;
					if(!txtBoxName || txtBoxName==0){
						document.getElementById(txtBox).value = 1;
						}
					
					}
		
		
		
				/////////////////////////////////////////////////////////////////////////////////////////////////////
				//DREAMVEAWER FUNCTIONS
				/////////////////////////////////////////////////////////////////////////////////////////////////////
				
				function MM_preloadImages() { //v3.0
				  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
					var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
					if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
				}
				function MM_swapImgRestore() { //v3.0
				  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
				}
				function MM_findObj(n, d) { //v4.01
				  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
					d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
				  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
				  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
				  if(!x && d.getElementById) x=d.getElementById(n); return x;
				}
				
				function MM_swapImage() { //v3.0
				  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
				   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
				}
		
		
		
		
		//-->
