/* Created by Jason Phoon For IE 6 Warm Message */  
function centralize(){  
 var windowWidth = document.documentElement.clientWidth;  
 var windowHeight = document.documentElement.clientHeight;  
 var popupHeight = $("#ie6").height();  
 var popupWidth = $("#ie6").width();  
 $("#ie6").css({  
  "position": "absolute",  
  "top": windowHeight/2-popupHeight/2,  
  "left": windowWidth/2-popupWidth/2  
 });  
 $("#iebg").css({  
  "width": windowWidth,  
  "height": 1945  
 });   
}  
function closeie6(){  
 $("#iebg").fadeOut(600);  
 $("#ie6").toggle(500);  
 $("select").css({ "visibility" : "visible" });  
}  
function is_ie6(){ return ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)); }  
$(document).ready(function(){  
 if (is_ie6()) {  
  var msg1 = "คุณทราบหรือไม่ว่าเบราว์เซอร์ของคุณต้องได้รับการอัพเดท";  
  var msg2 = "เพื่อประโยชน์สูงสุดในการใช้งานจากไซด์ของเรา เราแนะนำให้คุณอัพเกรดเบราว์เซอร์รุ่นใหม่ หรือใช้เบราว์เซอร์อื่น<br \/><br \/> ดูรายชื่อเบราว์เซอร์ที่นิยมใช้สูงสุด แล้วคลิกที่ไอคอนเพื่อดาวน์โหลด";  
  var ff = "Firefox 4+";  
  var chrome = "Chrome 12+ ";  
  var ie = "Internet Explorer 8+";  
  var safari = "Safari 5+";  
  var footer = "ต้องการอัพเกรดภายหลัง";  
  var cstyle = "<style type=\"text\/css\">";  
  cstyle += "#ie6 {position:absolute; z-index:9999; background:url(\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/ie6bg.gif) no-repeat; width: 700px;height: 390px;padding: 30px; font: 14px Arial,Helvetica,sans-serif; } ";  
  cstyle += "#ie6 a {text-decoration: none; cursor:pointer;} ";  
  cstyle += "#ie6 .ie6title {font:Arial, Helvetica, sans-serif; font-size: 24px; font-weight: 700; float: left; margin: 0 0 20px 0; width: 635px;} ";  
  cstyle += "#ie6 .ie6content1 {float: left; margin: 0 0 20px 0; width: 635px; line-height: 1.16em; size:13px;} ";  
  cstyle += "#ie6 .ie6content2 {float: left; margin: 0 0 15px 0;} ";  
  cstyle += "#ie6 .ie6footer {float: left; width: 635px; margin-top:20px; font-size: 11px; text-align: right; color:#000; text-decoration: underline;} ";  
  cstyle += "#ie6 .ie6browser1 {margin: 0; padding: 0} #ie6 .ie6browser2 {margin: 0; padding: 0}";  
  cstyle += "#ie6 .ie6browser1 li {display: inline; list-style:none; margin: 0 5px 0 0;}";  
  cstyle += "#ie6 .ie6browser2 li {display: inline; list-style:none;}";  
  cstyle += "#ie6 .ie6browser2 .firefox {margin: 0 35px 0 40px;}";  
  cstyle += "#ie6 .ie6browser2 .chrome {margin: 0 25px 0 50px;}";  
  cstyle += "#ie6 .ie6browser2 .ie {margin: 0 30px 0 35px;}";  
  cstyle += "#ie6 .ie6browser2 .safari {margin: 0 0 0 30px;}";  
  cstyle += "#ie6 .clear {clear: both;} ";  
  cstyle += "#iebg{position:absolute; top:0; left:0; height:100%; width:100%; background:#fff; filter:alpha(opacity=50);}";  
  cstyle += "<\/style>";  
  var cbody = "<div id=\"ie6\"> ";  
  cbody += " <div class=\"ie6title\">" + msg1 + "<\/div> ";  
  cbody += " <div class=\"ie6content1\">" + msg2 + "<\/div> ";  
  cbody += " <div class=\"iecontent2\"> ";  
  cbody += "  <ul class=\"ie6browser1\"> ";  
  cbody += "   <li><a href=\"http:\/\/www.mozilla.com\" target=\"_blank\">";  
  cbody += "    <img src=\"\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/firefox.jpg\" width=\"150\" height=\"124\" border=\"0\"><\/a>";  
  cbody += "   <\/li> ";  
  cbody += "   <li><a href=\"http:\/\/www.google.com\/chrome\/\" target=\"_blank\">";  
  cbody += "    <img src=\"\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/chrome.jpg\" width=\"150\" height=\"124\" border=\"0\"><\/a><\/li> ";  
  cbody += "   <li><a href=\http:\/\/www.microsoft.com\/windows\/Internet-explorer\/default.aspx\" target=\"_blank\">";  
  cbody += "    <img src=\"\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/ie.jpg\" width=\"150\" height=\"124\" border=\"0\"><\/a><\/li> ";  
  cbody += "   <li><a href=\"http:\/\/www.apple.com\/safari\/\" target=\"_blank\">";  
  cbody += "    <img src=\"\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/safari.jpg\" width=\"150\" height=\"124\" border=\"0\"><\/a><\/li> ";  
  cbody += "  <\/ul> ";  
  cbody += "  <ul class=\"ie6browser2\"> ";  
  cbody += "   <li class=\"firefox\">" + ff + "<\/li> ";  
  cbody += "   <li class=\"chrome\">" + chrome + "<\/li> ";  
  cbody += "   <li class=\"ie\">" + ie + "<\/li> ";  
  cbody += "   <li class=\"safari\">" + safari + "<\/li> ";  
  cbody += "  <\/ul> ";  
  cbody += " <\/div> ";  
  cbody += " <div class=\"ie6footer\"> ";  
  cbody += "  <a id=\"close\" href=\"#\" style=\"color:#000\">"+ footer + "";  
  cbody += "   <img src=\"\/iwov-resources\/my\/common\/images\/AirAsia\/ie6\/close.jpg\" width=\"9\" height=\"9\" border=\"0\">";  
  cbody += "  <\/a> ";  
  cbody += " <\/div> ";  
  cbody += " <div class=\"clear\"><\/div> ";  
  cbody += "<\/div> ";  
  cbody += "<div id=\"iebg\"><\/div>";  
  $('head').append(cstyle);  
  $('body').append(cbody);  
  $("select").css({ "visibility" : "hidden" }); //to solve the select overlap problem  
  $("#close").click(function(){ closeie6();});  
  centralize();   
 }  
});  
