		function getInternetExplorerVersion()
		// Returns the version of Internet Explorer or a -1
		// (indicating the use of another browser).
		{
		  var rv = -1; // Return value assumes failure.
		  if (navigator.appName == 'Microsoft Internet Explorer')
		  {
		    var ua = navigator.userAgent;
		    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		    if (re.exec(ua) != null)
		      rv = parseFloat( RegExp.$1 );
		  }
		  return rv;
		}
		function checkVersion()
		{
		  var msg = "You're not using Internet Explorer.";
		  var ver = getInternetExplorerVersion();

		  if ( ver > -1 )
		  {
		    if ( ver >= 8.0 ) 
		      msg = "You're using a recent copy of Internet Explorer."
		    else
		      msg = "You should upgrade your copy of Internet Explorer.";
		  }
		  
		  return ver;
		  //alert( msg );
		}
		
function reset_contactus() {
		//2011 10 11
	$("#frmContactUs input").val('');
	$("#frmContactUs textarea").val('');
}

function hideallpanel()
{
	$(".panel").each(function(intIndex)
			{
				$(this).hide();
			}
		);
	
}

function showpanel(panel)
{
	hideallpanel();
	
	$(".panel:nth-child(" + panel + ")").show();
	
}

function ProcessInnerMenu() {
	$("#PageMenuDiv ul").show();
	$("#PageMenuDiv li").show();
	$("#PageMenuDiv a").show();
	
	//clear level one a
	// done
	// hide level 1 items
	$("#PageMenuDiv ul li a").hide();
	//$("#PageMenuDiv ul li").hide();
	
	// hide level 2 items
	$("#PageMenuDiv ul li ul li a").hide();
	//$("#PageMenuDiv ul li ul li ul").hide();
	//$("#PageMenuDiv ul li ul li").hide();
	
	// hide level 3 items
	$("#PageMenuDiv ul li ul li ul li a").hide();
	//$("#PageMenuDiv ul li ul li ul li").hide();
	// done

	var max = 0;
	$("li:not(:has(ul))").each(function() {
	  var cur = $(this).parents("ul").length;
	  if (cur > max) max = cur;
	});
	
	
	 
	var ActiveLi = $("#PageMenu li[data-object_link_id='" + ObjLinkID + "']");
	
	depth = ActiveLi.parents("ul").length;
	
	ActiveLi.addClass("FoundLink");
	
	if (depth == 2) {
		
		//alert(2);
		//folder name
		ActiveLi.parent().siblings().show();
		ActiveLi.parent().siblings().addClass("active_link");
		//ActiveLi.children().addClass("active_link");
		
		//my a
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder");
		
		// sub links in the same level as mine
		ActiveLi.siblings().children().show();
		ActiveLi.siblings().children().addClass("active_folder");
		
		// previous folder's headings
		// if active li in level 2 
		ActiveLi.parents("li").siblings().children().show();
		ActiveLi.parents("li").siblings().children().addClass("active_folder");
		
		
		ActiveLi.parents("li").show();
		ActiveLi.parents("li").addClass("active_folder1");
		
		ActiveLi.siblings().show();
		ActiveLi.siblings().addClass("active_folder2");
		
		ActiveLi.show();
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder3");
		
	}
	else {
		//alert(3);
		
		ActiveLi.parent().siblings().show();
		ActiveLi.parent().siblings().addClass("active_folder");
		//ActiveLi.children().addClass("active_link");
		
		//my a
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_link");
		
		// sub links in the same level as mine
		ActiveLi.siblings().children().show();
		ActiveLi.siblings().children().addClass("active_link");
		
		// previous folder's headings
		// if active li in level 2 
		ActiveLi.parents("li").siblings().children().show();
		ActiveLi.parents("li").siblings().children().addClass("active_folder");
		
		ActiveLi.parents("li").show();
		ActiveLi.parents("li").addClass("active_folder1");
		
		ActiveLi.siblings().show();
		ActiveLi.siblings().addClass("active_folder2");
		
		ActiveLi.show();
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder3");
		
	}
	
	$("#PageMenuDiv>ul>li>a").hide();
	/*
	$("#PageMenuDiv>ul>li.active_link, #PageMenuDiv>ul>li.active_folder").each(function(){
		   if($(this).find("li:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());
		   
		   if($(this).find("a:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());

		});
	
	$("#PageMenuDiv>ul>li>a.active_link, #PageMenuDiv>ul>li>a.active_folder").each(function(){
		   if($(this).find("li:visible").size() == 0) {
			   $(this).hide("slow");
		   	   $(this).addClass("RedBG");
		   	   $(this).children().addClass("RedBG");
		   	   
		   }
		   else
			   alert($(this).find("li:visible").size());

		   if($(this).find("a:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
			   //$(this).parent("li").addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());

		});
		*/		
}

function ProcessInnerMenu_IE7() {
	$("#PageMenuDiv ul").show();
	$("#PageMenuDiv li").show();
	$("#PageMenuDiv a").show();
	
	//clear level one a
	// done
	// hide level 1 items
	$("#PageMenuDiv ul li a").hide();
	$("#PageMenuDiv ul li").hide();
	
	// hide level 2 items
	$("#PageMenuDiv ul li ul li a").hide();
	$("#PageMenuDiv ul li ul li ul").hide();
	//$("#PageMenuDiv ul li ul li").hide();
	
	// hide level 3 items
	$("#PageMenuDiv ul li ul li ul li a").hide();
	$("#PageMenuDiv ul li ul li ul li").hide();
	// done

	var max = 0;
	$("li:not(:has(ul))").each(function() {
	  var cur = $(this).parents("ul").length;
	  if (cur > max) max = cur;
	});
	
	
	 
	var ActiveLi = $("#PageMenu li[data-object_link_id='" + ObjLinkID + "']");
	
	depth = ActiveLi.parents("ul").length;
	
	ActiveLi.addClass("FoundLink");
	
	if (depth == 2) {
		
		//alert(2);
		//folder name
		ActiveLi.parent().siblings().show();
		ActiveLi.parent().siblings().addClass("active_link");
		//ActiveLi.children().addClass("active_link");
		
		//my a
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder");
		
		// sub links in the same level as mine
		ActiveLi.siblings().children().show();
		ActiveLi.siblings().children().addClass("active_folder");
		
		// previous folder's headings
		// if active li in level 2 
		ActiveLi.parents("li").siblings().children().show();
		ActiveLi.parents("li").siblings().children().addClass("active_folder");
		
		
		ActiveLi.parents("li").show();
		ActiveLi.parents("li").addClass("active_folder1");
		
		ActiveLi.siblings().show();
		ActiveLi.siblings().addClass("active_folder2");
		
		ActiveLi.show();
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder3");
		
	}
	else {
		//alert(3);
		
		ActiveLi.parent().siblings().show();
		ActiveLi.parent().siblings().addClass("active_folder");
		//ActiveLi.children().addClass("active_link");
		
		//my a
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_link");
		
		// sub links in the same level as mine
		ActiveLi.siblings().children().show();
		ActiveLi.siblings().children().addClass("active_link");
		
		// previous folder's headings
		// if active li in level 2 
		ActiveLi.parents("li").siblings().children().show();
		ActiveLi.parents("li").siblings().children().addClass("active_folder");
		
		ActiveLi.parents("li").show();
		ActiveLi.parents("li").addClass("active_folder1");
		
		ActiveLi.parent("ul").show();
		ActiveLi.parent("ul").addClass("active_folder4");
		
		ActiveLi.parent("ul").show();
		ActiveLi.parent("ul").addClass("active_folder4");
		
		ActiveLi.parent("ul").parent().siblings().show();
		ActiveLi.parent("ul").parent().siblings().addClass("active_folder5");
		
		ActiveLi.siblings().show();
		ActiveLi.siblings().addClass("active_folder2");
		
		ActiveLi.show();
		ActiveLi.children().show();
		ActiveLi.children().addClass("active_folder3");
		
	}
	
	$("#PageMenuDiv>ul>li>a").hide();
	/*
	$("#PageMenuDiv>ul>li.active_link, #PageMenuDiv>ul>li.active_folder").each(function(){
		   if($(this).find("li:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());
		   
		   if($(this).find("a:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());

		});
	
	$("#PageMenuDiv>ul>li>a.active_link, #PageMenuDiv>ul>li>a.active_folder").each(function(){
		   if($(this).find("li:visible").size() == 0) {
			   $(this).hide("slow");
		   	   $(this).addClass("RedBG");
		   	   $(this).children().addClass("RedBG");
		   	   
		   }
		   else
			   alert($(this).find("li:visible").size());

		   if($(this).find("a:visible").size() == 0) {
			   $(this).hide("slow");
			   $(this).addClass("RedBG");
			   $(this).children().addClass("RedBG");
			   //$(this).parent("li").addClass("RedBG");
		   }
		   else
			   alert($(this).find("li:visible").size());

		});	
		*/	
}
$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();

	$('a.MySubmitButton').click( function(ev) {
		ev.preventDefault();
		if ($(this).attr('target') != '') {
			$('#' + $(this).attr('target')).submit();
		}
	});
	
	
	
	$(".innertopmenu li").mouseover(function() {
		
		width = $(this).prevAll("li").length;
		//alert(width);
		var submenu_margin_left = 60;
		switch (width) {
			case 0: 
			case 1: submenu_margin_left += 0; break;
			case 2: submenu_margin_left += 80; break;
			case 3: submenu_margin_left += 160; break;
			case 4: submenu_margin_left += 245; break;
			case 5: submenu_margin_left += 328; break;
			case 6: submenu_margin_left += 425; break;
			case 7: submenu_margin_left += 400; break;
			case 8: submenu_margin_left += 542; break;
			
			
		}
		
		$(".InnerSubMenu").css("margin-left", submenu_margin_left + "px");
		
		var id = $(this).attr("data-object_id");
		
		var themenu = $("#mySubMenu>li[data-object_id='" + id + "']>ul").html();
		
		$(".innersubmenu").html(themenu);
		
		if (width > 0)
			$(".InnerSubMenu").show();
		else
			$(".InnerSubMenu").hide();
	});

	$(".InnerSubMenu").mouseover(function() {
		
		$(".InnerSubMenu").show();
	});
	

	
	$(".InnerSubMenu").mouseout(function() {
		
		$(".InnerSubMenu").hide();
	});
	
	if (MyJS == 'Inner')
	{
		/*
		NS4 = (document.layers) ? true : false;
		IE4 = (navigator.appVersion.indexOf("MSIE 4.")==-1)? false : true;
		IE5 = (navigator.appVersion.indexOf("MSIE 5.")==-1) ? false : true;
		IE6 = (navigator.appVersion.indexOf("MSIE 6.")==-1) ? false : true;
		IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
		ver4 = (NS4 || IE4plus) ? true : false;
		NS6 = (!document.layers) && (navigator.userAgent.indexOf("Netscape")==-1)) ? false : true;
*/
		

		//alert(getInternetExplorerVersion);
		var ieversion = checkVersion();
		
		//alert(ieversion);
		//ProcessInnerMenu();
		
		if (ieversion > 7 || ieversion == -1) {
			//alert("non IE7");
			ProcessInnerMenu();
		}
		else {
			//alert("IE7");
			ProcessInnerMenu_IE7();
		}
		
			
		
		
		
			
		
		//33528
		
	}
		
	if (MyJS == 'Index')
	{
		$(function() {
			$("div#makeMeScrollable").smoothDivScroll({ autoScroll: "always", autoScrollDirection: "endlessloopright", autoScrollStep: 1, autoScrollInterval: 100, visibleHotSpots: "always"});
		});
		
		hideallpanel();
		showpanel(1);
		
		$(".IndexTopMenu ul li:last").css("border", "0px solid #ffffff");
		$(".IndexTopMenu").show();
		

	}
	else
	{
		$(".InnerTopMenu ul li:last").css("border", "0px solid #ffffff");
		$(".InnerTopMenu").show();
		
		var left_h = $(".Left").height();
		var right_h = $(".Right").height();
		
		if (left_h < right_h) {
			if ($(".product_content").height() <= 0) {
				if ($(".news_content").height() <= 0) {
					//alert(1);
					//alert(left_h + ":" + right_h);
					$(".Left").height($(".Right").height()-14);
				}
				else {
					//alert(4);
					//alert(left_h + ":" + right_h);
					$(".Left").height($(".Right").height()-34);
				}
			}
			else {
				//alert(2);
				$(".Left").height($(".RightContent").height()+50);
			}
		}
		else {
			//alert(3);
			$(".inner_content").height($(".Left").height() - 85);
			$(".news_content").height($(".Left").height() - $(".EventHighlight").height() - 95);
			
		}
		
	}
	
	
	
	

	
});

$(window).load(function() {
	
	//alert(left_h + ":" + right_h);
	
});
