//GLOBAL Variables
var currentProjectIndex; //Starts at 1 and is the actual XML ID number
var currentDescriptionArray; 
var currentDescriptionArray2; //tooltip array 

//Current Image
var selectedimage_index;

//Tooltip time delay
var tooltip_timer;
var tooltip_timer2;
var isTooltipOn = false;

//Slideshow
var isSlideshowAdvancing = false;
var isSlideshowRetreating = false;
var isSlideshowOn = false;

var projectImagesPath = 'content/selected_work/';

//Menu selected indicators for click action
var menuClicked = new Array(false,false,false);
var menuSelectedWorksList = true;
var menuContainerNames = new Array("#container_inner_work","#container_inner_about");

var menuInitialized = false;

var openMenuHeight = '100px';
var closeMenuHeight = '11px';

//DOM LOADED
$(document).ready(function(){
			
			//PREVENT MOVEMENT IF IPAD
			/*	$('body').bind('touchmove', function(event){
					event.preventDefault();
				});
			*/
					
					
			//Delay animation
			var beginningAnimationTimer = setTimeout('beginningAnimation()', 750);
			
			//Select CONTENT XML as the default one
			activateXMLDocument(xmlContent);
			populateMenu();
			

			
			//RECODE EMAIL
			$('a.email').nospam({ replaceText: true }); 
		
			
			//EVENT HANDLING
			//Menu links are bound in separate function
			
			//BRING LARGE MENU TO TOP
			$('#nav_large_menu li').mouseover(function(){
				$('#nav_large').addClass('zTop');
			});
			$('#nav_large_menu li').mouseout(function(){
				$('#nav_large').removeClass('zTop');
			});
			
			
			//News Hover
			$("#nav_large_menu li:eq(2)>a>img").hover(function() {
			    largeMenuHoverOn(2);
			  }, function() {
			    largeMenuHoverOff(2);
			    });
			    
			
			//Large Menu Display Content
			//SELECTED WORKS
			$('#nav_large_menu li:eq(0)>a, #container_inner_work').bind({
					  
					  mouseover: function() {
			    			largeMenuHoverOn(0);
					  },
					  mouseout: function() {
					  	if(menuClicked[0]==false){
					  			largeMenuHoverOff(0);
					  	}
					  },
					  click: function() {
					  		if(menuClicked[0] && isSlideshowOn){ //If menu is already on and slideshow is present, switch between description and links
								if(menuSelectedWorksList){
									hideWorksList();
									menuSelectedWorksList = false;
									}else{
									displayWorksList();
									menuSelectedWorksList = true;
									}
					  		}else{
					  			menuInitialization();
								largeMenuOnClick(0);
					  		}
						  }
			});
			
			//ABOUT 
			$('#nav_large_menu li:eq(1)>a, #container_inner_about').bind({
					  
					  mouseover: function() {
			    			largeMenuHoverOn(1);
					  },
					  mouseout: function() {
					  	if(menuClicked[1]==false){
					  			largeMenuHoverOff(1);
					  	}
					  },
					  click: function() {
					  		menuInitialization();
							largeMenuOnClick(1);			  	
						  }
			});
  			
  			
    		//ARROW EVENTS
    		//Left Arrow
    		$("#container_inner_imagearea_left").hover(function(){ 
    				$(this).fadeTo('fast', 1);
    				//If Selected Work is already selected, temporarily hide works list
    				if(menuClicked[0]){
 		   				hideWorksList();
 		   				}
    				
    				
    			}, function(){ 
    				if(jQuery.browser.mobile==false && isiPad==false){
    					$(this).fadeTo('fast', 0);
    				}
    				if(menuClicked[0] && menuSelectedWorksList){
 		   				displayWorksList();
 		   				}
    			});
    		$("#container_inner_imagearea_left a").click(function(){ 
    			if($('#container_inner_imagearea_images ul').queue('fx').length<3){	//Prevent Too many clicks all at once	
    				retreatSlideshow(); 
    			}
    		});
    		
    		//Right Arrow
    		$("#container_inner_imagearea_right").hover(function(){ 
    				$(this).fadeTo('fast', 1);
    				if(menuClicked[0]){
 		   				hideWorksList();
 		   				}
    			}, function(){ 
    				if(jQuery.browser.mobile==false && isiPad==false){
    					$(this).fadeTo('fast', 0);
    				}
    				if(menuClicked[0] && menuSelectedWorksList){
 		   				displayWorksList();
 		   				}
    			});    		
    		$("#container_inner_imagearea_right a").click(function(){ 
    			if($('#container_inner_imagearea_images ul').queue('fx').length<3){	//Prevent Too many clicks all at once	
    				advanceSlideshow(); 
    			}
    		});
    		
    		
});
//END OF DOM LOADED


//MISC FUNCTIONS
//POPULATE MENU
function populateMenu(){
//Clear .works_list_col first
$('.works_list_col').empty();

//Populate Works List (Separate into 5 Columns; MAX 9 per column)
			var tempworkslist='';
			var tempworkscount=0;
			var tempworkschild = '';
			for(var k=1; k<6; k++){
			
				for(var i=0; i<9 && tempworkscount<projectNamesArray.length; i++){
				
		
							tempworkslist = tempworkslist + '<li><a id="project_' + projectNamesIDArray[tempworkscount] + '">' + projectNamesArray[tempworkscount] + '</a></li>';
							//For extremely long names, move forward one line
							if(projectNamesArray[tempworkscount].length>23){
								i++;
							}
							tempworkscount++;
							
				
				}
				
				
				
				tempworkschild = '#works_list ul:nth-child(' + k + ')';
				$(tempworkschild).append(tempworkslist);
			
				tempworkslist = '';
			
			}

			// EVENT HANDLING
			// BIND LIST OF SELECTED PROJECTS
			$('#works_list a').click(function(e){
					
					var tempIDName = $(this).attr('id');
					var tempIDNameArray = tempIDName.split('_');
					var tempIDNumber = parseInt(tempIDNameArray[1]);
					
					selectedProject(tempIDNumber);
					
					//SOMETHING FUNKY GOING ON WITH THIS STOP PROPAGATION
					e.stopImmediatePropagation();
					
				
				});
			

}





//BEGINNING ANIMATION FUNCTIONS
function beginningAnimation(){
			$('#nav_large_logo_white').fadeTo(1000, 0.15, function(){
				$(this).hide();
				$('#nav_large_logo_dark').show();
			});
			$('#nav_large_menu').fadeTo(1000, 1);
			$('#nav_large_address').fadeTo(1000, 0, animateContainer());
}
		
		
//Fade In Container
function animateContainer(){
			$('#nav_large').mouseover(function(){ $('#container').fadeIn(1000); });

}
//END OF BEGINNING ANIMATION FUNCTIONS	


//MENU-CONTENT ANIMATIONS	
function menuInitialization(){
			if(menuInitialized==false){
				$('#container_inner_menu').animate({
					marginTop: '0px'
				}, 'slow');
				menuInitialized=true;
			}
}


//EVENT HANDLING FUNCTIONS		
//LARGE LINKS HOVER IMAGE STATES
function largeMenuHoverOn(menuID){
			$("#nav_large_menu li:eq(" + menuID + ") > a > img:not(.menu_one)").stop().fadeTo(400, 1.0, function(){	//.menu_one denotes the dark grey menu image
				
					$("#nav_large_menu li:eq(" + menuID + ") > a > img.menu_one").stop().fadeTo(0, 0);
			});
}
		
function largeMenuHoverOff(menuID){
			
			$("#nav_large_menu li:eq(" + menuID + ") > a > img.menu_one").stop().fadeTo(0, 1.0, function(){	//.menu_one denotes the dark grey menu image
		
					$("#nav_large_menu li:eq(" + menuID + ") > a > img:not(.menu_one)").stop().fadeTo(400, 0);
			});
}
		
		
		
//OPEN-CLOSE MENU
function openMenuContainer(menuContainerName){
			$(menuContainerName).animate({
				height: openMenuHeight
			}, 'slow', fadeInMenuContent(menuContainerName));
}
		
function closeMenuContainer(menuContainerName){
			$(menuContainerName).animate({
				height: closeMenuHeight
				}, 'slow');
}
		
//FADE IN-OUT CONTENT
function fadeInMenuContent(menuContainerName){
			$(menuContainerName).children(".col2_long").fadeIn("fast");
}
		
function fadeOutMenuContent(menuContainerName){
			$(menuContainerName).children(".col2_long").fadeOut("fast", closeMenuContainer(menuContainerName));
}
		
		
//LARGE LINK ONCLICK
function largeMenuOnClick(menuID) {

					  		if(menuClicked[menuID]==false){
					  			//Loop through all the items, fade out content, and close
					  			for(var i=0; i<menuClicked.length; i++){
					  				if(menuClicked[i]){
					  					var tempMenuContainerName = menuContainerNames[i];
					  					fadeOutMenuContent(tempMenuContainerName);
					  					//closeMenuContainer(tempMenuContainerName);
					  					largeMenuHoverOff(i);
					  					menuClicked[i]=false;
					  					if(menuClicked[i]==0){
					  						displayWorksList();
					  						menuSelectedWorksList = true;
					  					}
					  				}
					  			}
					  			menuClicked[menuID]=true;
					  			var tempMenuContainerNameSelected = menuContainerNames[menuID];
					  			//fadeInMenuContent(tempMenuContainerNameSelected);
					  			openMenuContainer(tempMenuContainerNameSelected);
					  			largeMenuHoverOn(menuID);
					  		}
						$('#nav_large').removeClass('zTop');
}	
		
		
//CONTAINER ONCLICK
function menuContainerOnClick(menuID) {
					  		if(menuClicked[menuID]==false){
					  			//Loop through all the items, fade out content, and close
					  			for(var i=0; i<menuClicked.length; i++){
					  				if(menuClicked[i]){
					  					var tempMenuContainerName = menuContainerNames[i];
					  					fadeOutMenuContent(tempMenuContainerName);
					  					//closeMenuContainer(tempMenuContainerName);
					  					largeMenuHoverOff(i);
					  					menuClicked[i]=false;
					  					if(menuClicked[i]==0){
					  						displayWorksList();
					  						menuSelectedWorksList = true; //Reset Selected Works List
					  					}
					  				}
					  			}
					  			menuClicked[menuID]=true;
					  			var tempMenuContainerNameSelected = menuContainerNames[menuID];
					  			//fadeInMenuContent(tempMenuContainerNameSelected);
					  			openMenuContainer(tempMenuContainerNameSelected);
					  			largeMenuHoverOn(menuID);
					  		}
}	

		
//Display and Hide Selected Works Client List WITHOUT Collapsing Container
function displayWorksList(){
		
				$('#works_description').stop(true, true).fadeOut(0, function(){
					$('#works_list').fadeIn(500);
				});
			
}
		
function hideWorksList(){
			$('#works_list').stop(true, true).fadeOut(0, function(){
				$('#works_description').fadeIn(500);
			});
			
}


//END OF MENU-CONTENT ANIMATIONS		
		
//CLIENT/PROJECT SELECTION ONCLICK
function selectedProject(projectIndex){ //INDEX SHOULD BE THE ID NUMBER SPECIFIED IN XML
  				//If menuClicked is on, turn off
  				if(menuClicked[0]){
  					//hideWorksList();
  					//menuClicked[0]=false;
  					//$("#nav_large_menu li:eq(0) > a > img").attr("src", $("#nav_large_menu li:eq(0) > a > img").attr("src").split("-hover.").join("-nohover."));
  				}
  				fadeLogo(projectIndex);
  				$('#works_description').fadeOut(0); 
  				
}
		
		
//DISPLAYS THE PROJECT IMAGES
function fadeLogo(tempprojectnumber){ //INDEX SHOULD BE THE ID NUMBER SPECIFIED IN XML
			
			if(isSlideshowOn==false){
				//Fade Out Liinc Logo once
				//Fade Out Logo
				$('#liinc_logo').fadeOut('slow');
				isSlideshowOn = true;
			}else{
				stopTooltip();
				//$('#tooltip_box').fadeTo(0, 0);
				clearImageArea();
			}
			
			
			//Load Project Image Array			
			var tempImagesArray = getClientImage(tempprojectnumber);
			
			//Videos
			var videoNamesArray = new Array();
			var videoFilePathArray = new Array();
			var videoNamesArrayCounter=0;
			var areThereVideos = false;
			
			
			var tempImages = '';
			for(var i=0; i<tempImagesArray.length; i++){
					
					//If video format, there will be no specified extensions. Check to see if video.
					//Perform String function to find period
					var tempPeriodPosition = tempImagesArray[i].length-4;
							
					if(tempImagesArray[i].charAt(tempPeriodPosition)=='.'){ //If Image

						if(i==0){
								
							tempImages = tempImages + '<li class="selectedimage firstitem"><img src="' + projectImagesPath + tempImagesArray[i] + '" style="display: none;" class="image_invisible" /></li>';
	
						}else{
							tempImages = tempImages + '<li><img src="' + projectImagesPath + tempImagesArray[i] + '" style="display: none;" class="image_invisible" /></li>';
						}


					}else { //IF VIDEO
						areThereVideos = true;
						videoNamesArray[videoNamesArrayCounter] = tempImagesArray[i];
						videoFilePathArray[videoNamesArrayCounter] = projectImagesPath + tempImagesArray[i];
					
						videoNamesArrayCounter++;
						

						
						var tempJplayerVideoCode = '<div id="video_container_' + tempImagesArray[i] + '" class="jp-video"></div>';
						
						if(i==0){
								
							tempImages = tempImages + '<li class="selectedimage firstitem">' + tempJplayerVideoCode + '</li>';
	
						}else{
							tempImages = tempImages + '<li>' + tempJplayerVideoCode + '</li>';
						}

					}
					
			}
				
			currentProjectIndex = tempprojectnumber;
			
			$('#container_inner_imagearea_images ul').append(tempImages);
			$('#container_inner_imagearea_box').fadeIn('slow');
			
			//Display the individual Images in Sequence
			for(var i=0; i<tempImagesArray.length; i++){
				$('#container_inner_imagearea_box img:eq(' + i + ')').show(0).delay(850).fadeTo(500, 1);
			}
			
		
			
			//Show Arrow Containers
			$('#container_inner_imagearea_left').show(0);
			$('#container_inner_imagearea_right').show(0);
			
			//IF MOBILE BROWSER, TURN ON ARROWS AT ALL TIMES
    		if(jQuery.browser.mobile || isiPad){
    			$("#container_inner_imagearea_left").fadeTo('fast', 1);
    			$("#container_inner_imagearea_right").fadeTo('fast', 1);
    		}
    		
    		
    		
    		selectedimage_index = 0;
    		
    		
			//Load Descriptions
			loadDescriptions(0);
			
			//Tooltip
			tooltip(selectedimage_index);
			
			//Load Videos
			if(areThereVideos){
				
				//Width Adjustment for Bug in Safari 5.0 that distorts video
				$('#container_inner_imagearea_images').addClass('width_adjustment_safari');
			
				for(var k=0; k<videoNamesArray.length; k++){
						
						//Need to specify specific path for jPlayer Eccentricity
						var tempFileM4V = 'http://www.liinc.com/' + videoFilePathArray[k] + '.m4v';
						//Disabling OGV files b/c of lack of converter
						//var tempFileOGV = 'http://www.liinc.com/' +  videoFilePathArray[k] + '.ogv';
						var tempFileJPG = 'http://www.liinc.com/' +  videoFilePathArray[k] + '.jpg';
				
				      $('#video_container_' + videoNamesArray[k]).jPlayer({
					        ready: function () {
		    		      		$(this).jPlayer('setMedia', {
			       	     			m4v: tempFileM4V,
			      		      //		ogv: tempFileOGV,
			     	       			poster: tempFileJPG
			     	    		 }).jPlayer('play'); //Autoplay
		    		    	},
			  				 //     ended: function() {
						   	//     	$(this).jPlayer("play"); //Repeat
					 	  	//     },
					 	  	solution: "html, flash",
					 	  	wmode: "window", //Must for FF3.6 if using Flash
					 	  	preload: "auto",
					 //	  	errorAlerts: true,
					 //	  	warningAlerts: true,
					        swfPath: '/js',
					 		supplied: 'm4v',
					 //       supplied: 'm4v, ogv',
				        	size: { width: '740px', height: '425px' }
		   			   });
		   			   
		   		} 
			}else{
		   			//Remove width Adjustment
		   			$('#container_inner_imagearea_images').removeClass('width_adjustment_safari');
		   		}
			
}


//CLEAR IMAGE AREA
function clearImageArea(){
	//Fade Out Current Images
	$('#container_inner_imagearea_images ul').empty();
	//Reset UL Position
	$('#container_inner_imagearea_images ul').animate({left:'0px'}, 0);
}

//CLEAR DESCRIPTIONS
function clearDescriptions(){
	$('#works_description').empty();
}
		
//LOAD DESCRIPTIONS
function loadDescriptions(currentProjectImageIndex){
			
			currentDescriptionArray = getClientImageDescription(currentProjectIndex);
			currentDescriptionArray2 = getClientImageText(currentProjectIndex);


//			var tempDescription = '<p>' + currentDescriptionArray[currentProjectImageIndex] + '<br /><br /><em>' + currentDescriptionArray2[currentProjectImageIndex] + '</em></p>';
						var tempDescription = '<p>' + currentDescriptionArray[currentProjectImageIndex] + '</p>';
			
			clearDescriptions();
			$('#works_description').append(tempDescription);
}
		

//TOOLTIP
function tooltip(temp_selectedimage_index){

	tooltip_timer = setTimeout(function(){
		if(currentDescriptionArray2[temp_selectedimage_index] != '' && currentDescriptionArray2[temp_selectedimage_index] != ' '){
			$('#tooltip_box').empty(); //Previously edited out
			$('#tooltip_box').append(currentDescriptionArray2[temp_selectedimage_index]);
			$('#tooltip_box').fadeTo(100, 1, function(){ 
				isTooltipOn = true; 
				tooltip_fadeout();
			});
		}			
	}, 1500);
}

function tooltip_fadeout(){
	tooltip_timer2 = setTimeout(function(){
			$('#tooltip_box').fadeTo(100, 0, function(){ isTooltipOn = false; });
	}, 5000); //previously 3000
}

function stopTooltip(){
	$('#tooltip_box').stop(false, false); //stops animation
//	$('#tooltip_box').removeAttr('style'); //clears the attributes
	$('#tooltip_box').attr('style', 'display: none;'); //reset attributes
	$('#tooltip_box').empty();
	clearTimeout(tooltip_timer); //Clear timemouts
	clearTimeout(tooltip_timer2); //clear timeouts
	isTooltipOn=false;
}


		
//SLIDESHOW
//Advance the slideshow
function advanceSlideshow(){
			if(isSlideshowAdvancing==false){
			
				isSlideshowAdvancing=true;
				stopTooltip();
			
				//Get Total Number of elements
				var totalnoimages = $('#container_inner_imagearea_box li').length;
						
				//Get Index Number
				selectedimage_index = $('.selectedimage').index();
				var selectedimages_index_new = selectedimage_index+1;
				
				
				
				//Get current selected width 
				var selectedimage_width;
				if(selectedimages_index_new==1){
					selectedimage_width = $('.selectedimage').outerWidth()-40; //Compensate for first image
				} else{
					selectedimage_width = $('.selectedimage').outerWidth();
				}
				
				//Advance only if there are more images. If not, move to next project.
				if(selectedimages_index_new<totalnoimages){
					
					
				
					//Remove selected
					$('.selectedimage').removeClass('selectedimage');
					
					//slide UL to the left by that amount
					$('#container_inner_imagearea_images ul').animate({
						left: '-='+selectedimage_width
					}, 1000, function(){
						//Tooltip
						selectedimage_index = selectedimages_index_new;
						tooltip(selectedimage_index);
					
					});
					
					//place "selected" on the next element
					$('#container_inner_imagearea_box li').eq(selectedimages_index_new).addClass('selectedimage');
					
					//Change Project Description
					loadDescriptions(selectedimages_index_new);
					
					
					
				}else {
				
					//NEXT PROJECT (LOOP IF AT END)
					//From currentProjectIndex, get proper Array ID and advance					
					var tempCurrentIDArrayIndex = xmlIDtoArrayID(currentProjectIndex);
					
					if(tempCurrentIDArrayIndex < projectNamesArray.length-1){
						tempCurrentIDArrayIndex++;
					}else{
						tempCurrentIDArrayIndex=0;
					}
					
					currentProjectIndex = projectNamesIDArray[tempCurrentIDArrayIndex];
					
					fadeLogo(currentProjectIndex);
					
				}
				
				isSlideshowAdvancing=false;
			}
			
}
		
//Retreat slideshow
function retreatSlideshow(){
			if(isSlideshowRetreating==false){
				stopTooltip();
				
				//Get Index Number
				selectedimage_index = $('.selectedimage').index();
				var selectedimages_index_new = selectedimage_index-1;
	
				//Advance only if there are more images. If not, move to next project.
				if(selectedimages_index_new>-1){
					
	
					//Get width of previous image 
					var selectedimage_width;
					if(selectedimage_index==1){
						selectedimage_width = $('#container_inner_imagearea_box li').eq(selectedimages_index_new).outerWidth()-40; //Compensate for first image
					} else{
						selectedimage_width = $('#container_inner_imagearea_box li').eq(selectedimages_index_new).outerWidth();
					}
					
					//Remove selected
					$('.selectedimage').removeClass('selectedimage');
					
					//slide UL to the left by that amount
					$('#container_inner_imagearea_images ul').animate({
						left: '+='+selectedimage_width
					}, 1000, function(){
						//Tooltip
						selectedimage_index = selectedimages_index_new;
						tooltip(selectedimage_index);
					
					});
					
					//place "selected" on the previous element
					$('#container_inner_imagearea_box li').eq(selectedimages_index_new).addClass('selectedimage');
				
					//Change Project Description
					loadDescriptions(selectedimages_index_new);
					
					
					
					
				}else{
					//PREVIOUS PROJECT
					var tempCurrentIDArrayIndex = xmlIDtoArrayID(currentProjectIndex);
					
					if(tempCurrentIDArrayIndex > 0){
						tempCurrentIDArrayIndex--;
					}else{
						tempCurrentIDArrayIndex=projectNamesArray.length-1;
					}
					
					currentProjectIndex = projectNamesIDArray[tempCurrentIDArrayIndex];
					
					
					fadeLogo(currentProjectIndex);
					
					
				}
				
				isSlideshowAdvancing=false;
			}
}
		
		
//FUNCTION TO DETERMINE THE COUNTER POSITION WITHIN projectNamesIDArray
function xmlIDtoArrayID(xmlIDNumber){
			var tempArrayID;
			
			for(var i=0; i<projectNamesIDArray.length; i++){
				if(xmlIDNumber==projectNamesIDArray[i]){
					tempArrayID = i;
					break;
				}
			}
			
			return tempArrayID;
}
		
		
//MOBILE BROWSER DETECTION
var isiPad = navigator.userAgent.match(/iPad/i) != null;

//jQuery.browser.mobile (http://detectmobilebrowser.com/)
//jQuery.browser.mobile will be true if the browser is a mobile device
(function(a){jQuery.browser.mobile=/android.+mobile|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);






