

window.onload = StartPopUp;

// after window gets loaded, invoke the StartPopUp function to generate popup message
//--------------------------FUNCTION StartPopUp----------------------------    
    function StartPopUp() {
     //******************START KS*****************
     if (CountryTag=="KS") {
		//var curScheduleYear; 
        //var curScheduleMonth; 
        //var curDate; 
        var found = false;
        var update = false;
        //var curScheduleDateArr;
        
        found = true;
        //curScheduleYear=2009;
        //curScheduleMonth=1;
        //curScheduleDateArr=14;
        if(found) {
            showPopup();
        }
        else
        {
            //alert("No schedule date is found!");
        }
       }
     //******************START US*****************
     else if(CountryTag=="US")  
     {
		var found = false;
		var d = new Date();
		var day=d.getDate();
		var hours=d.getHours();
 		if ( (day>=25 && day<=31)||(day==1 && hours<=12) ){ found = true;} 
       
        //found = true;
        if(found) {
			
            showPopup_US();
        }
        else
        {
            //alert("No schedule date is found!");
        }     
    }
      //******************START Cananda*****************
     else if(CountryTag=="CA")  
     {
		var found = false;
		var d = new Date();
		var day=d.getDate();
		var hours=d.getHours();
 		if ( (day>=28 && day<=31)||(day==1 && hours<=12) ){ found = true;} 
        
        //found = true;
        if(found) {
            showPopup_CA();
        }
        else
        {
            //alert("No schedule date is found!");
        }     
       } 
	//******************end Cananda***************** 
      //******************START TW*****************
     else if(CountryTag=="TW")  
     {
		var found = false;
    
        if (LangTag=="Cht")
        {
         //found = true;
        } 
        if(found) {
            showPopup_TW();
        }
        else
        {
            //alert("No schedule date is found!");
        }     
       } 
	//******************end TW*****************   
   //******************START HU ('HU ', 'BG ', 'CZ ', 'PL ', 'RO ', 'SI ', 'SK '))*****************
     else if (CountryTag=="HU"||CountryTag=="BG"||CountryTag=="CZ"||CountryTag=="PL"||CountryTag=="RO"||CountryTag=="SI"||CountryTag=="SK")  
     {
		var found = false;
        var StartDate = new Date("12/30/2009 15:00:00");
        var EndDate = new Date("1/03/2010 15:00:00");
        var d=new Date();
        if ( d > StartDate &&  d < EndDate)
        {
         found = true;
        }   
        
        if(found) {
            showPopup_HU();
        }
        else
        {
            //alert("No schedule date is found!");
        }     
       } 
	//******************end HU*****************     	  	     
    }
    
    
    
 //--------------------------FUNCTION myOnClick----------------------------       
    function myOnClick(e) {
	   		var currlocation;
	   		var newlocation="";
	   		currlocation=window.location.toString();
			var strSub1="";
			var strSub2="";
			
			var strStart=currlocation.indexOf(".asp?"); 
			var strLength;
			
			if (strStart>0){ 
			   strLength=currlocation.length;
			   strSub1 =currlocation.substring(0,strStart+5)
			   if (strLength > strStart+5){
			      strSub2="&"+currlocation.substring(strStart+5,strLength);}
			      newlocation=strSub1+"oksave=1"+ strSub2;
			}
			else
			{newlocation=currlocation+"?oksave=1";}	
			
			//alert(newlocation);
	   		//if (currlocation.indexOf("home.asp")>0 || currlocation.indexOf("favority.asp")>0 ||  currlocation.indexOf("Express.asp")>0){
	   		 //newlocation=currlocation+"?oksave=1"
	   		//} 
	   		//if(currlocation.indexOf("display_dept.asp")>0){
	   		 //newlocation=currlocation+"&oksave=1"
	   		//}
	   		
	   		if (LangTag=="Kor") {
	   		 	alert("½ÅÃ»ÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù.");
	   		 	window.location=newlocation;
	   		 	//window.location="home.asp?oksave=1" 

	   		 	//closePopup();
	   		 	  
	   		     }
	   		else{		
   	 			alert("Your application is successfully accepted."); 
	   		 	window.location=newlocation;
	   		 	//window.location="home.asp?oksave=1" 
	   		 	//closePopup();  
	   		} 
	   }	

 //--------------------------FUNCTION showPopup_US----------------------------       
    function showPopup_US() {
        
        //var period1 = true;
        //var period2 = true;
		var msgtitle;
		var msg1;
		var msg2;
		var msg3;
		var msg4;
		var msgbutton;
		var msgconfirm;
		var msgclose;
	   	
	   	var d = new Date();
		var day=d.getDate();
		var nextday=d.getDate()+1; //last day of the month
		var hours=d.getHours();
		var showmsg
		if (day>=25 && day<=31){ showmsg = 1;} 
		if (day==1 && hours<=12){ showmsg = 2;} 
		

       if (LangTag=="Spn") {
           
				if (showmsg==1){
					msg1="Sunrider IBOs, please be aware that all orders, Product Pack/Gift Set serial number transfers, and Sales Volume (SV) transfers made after Midnight, PST on the last day of the month will be applied to the next month.  "
					msg2="";
					msg3="";
					msg4="";
				}
				else if (showmsg==2){
					msg1="¡Información Importante!"
					msg2="Por favor tenga en cuenta que toda transacción ingresada en el sistema después de las 9:00 pm. tiempo del pacifico, en el último día del mes serán procesada y contadas automáticamente con el VV del próximo mes. Por lo tanto, para ser contado para el VV del mes actual: patrocinio, compras de productos, transferencias de Paquete de Producto/Set de Obsequio u otras transacciones debe ser completadas a mas tardar a las 9 p.m. Horario de Pacifico.";
					msg4="Si tiene alguna pregunta referente a este tema, por favor envíenos un correo electrónico a Servicio a Negocio a info@sunrider.com. Gracias";
					msg3=""
				}
				msgclose="Close";
  
        }
       else if (LangTag=="Chu") {
				if (showmsg==1){
					msg1="Sunrider IBOs, please be aware that all orders, Product Pack/Gift Set serial number transfers, and Sales Volume (SV) transfers made after Midnight, PST on the last day of the month will be applied to the next month.  "
					msg2="";
					msg3="";
					msg4="";
				}
				
				
				
				
				
				else if (showmsg==2){
					msg1="­«­n«H®§¡I"
					msg2="½Ðª`·N¡G©Ò¦³¨C¤ëªº³Ì«á¤@¤Ñ¦b¦è©¤®É¶¡±ß¤W9:00¥H«á¤Uªº¥æ©ö«ü¥O¡A³£·|¦Û°Ê°O¤J¤U­Ó¤ëªº·~ÁZ¤¤³B²z©Mµ²ºâ¡C¦]¦¹¡A¥]¬A·s¤Hµn°O¡B²£«~­qÁÊ¡BSVÂà²¾¡B²£«~®M²°/Â§²°Âà²¾¡A©Î¨ä¥¦¥ô¦ó§ó°Ê¡A¨ä«ü¥O¥²¶·©ó¦è©¤®É¶¡±ß¤W9:00¥H«e§¹¦¨¡A¤~¯à­p¤J·í¤ëSV¤¤¡C";
					msg4="¦p±z¹ï¦¹¦³¥ô¦óºÃ°Ý¡A½Ð¥H¹q¶l«t¸ß¥ø·~ªA°È³¡¡Rinfo@sunrider.com¡CÁÂÁÂ¡I";
					msg3=""
				}

				
				
				
				
				
				msgclose="Close";
  
           }          
       else{
			
				if (showmsg==1){
					msg1="Sunrider IBOs, please be aware that all orders, Product Pack/Gift Set serial number transfers, and Sales Volume (SV) transfers made after Midnight, PST on the last day of the month will be applied to the next month.  "
					msg2="";
					msg3="";
					msg4="";

				}
				
				else if (showmsg==2){				
					msg1="Important information!"
					msg2="Please note that all transactions entered in the system after 9 p.m. PDT. on the last day of the month will automatically be processed and counted with the next month’s SV.  Therefore,  to be counted for the current SV month: sponsoring, product purchases, SV transfers, Product Pack/Gift Set transfers, or any other transactions must be completed by 9 p.m., PDT.";
					msg4="If you have any questions regarding this issue, please email Business Service Reps at info@sunrider.com.  Thank you. ";
					msg3=""
				}	
					msgclose="Close";	
       
       }          
		// check for DOM if all elements are ready to parse
        //if(document && document.getElementsByTagName && document.getElementById && document.body) {
            
            // search for body element     
            var bodyElement = document.getElementsByTagName("body")[0];
            
            // create header for popup message
            var headerElement = document.createElement("div");
            headerElement.id = "header";
            
            // create close tag
            var closeLink = document.createElement("div");
            closeLink.id = "closeTag";
            closeLink.onclick = closePopup;
            closeLink.appendChild(document.createTextNode(msgclose));
            
            headerElement.appendChild(closeLink);
           
                 
            // create message title
            var msgElement = document.createElement("div");
            //msgElement.id = "msgbody";
            //msgElement.style.fontFamily = "Verdana";
            //msgElement.style.fontSize = "12px";
            //msgElement.style.padding = "10px";
			//msgElement.style.margin = "auto";
            //msgElement.style.width = "95%";
            //msgElement.appendChild(document.createTextNode(msg1));
			//var myText = document.createTextNode(msg1);
			//var font = document.createElement("font");
			//font.setAttribute('style', 'font-weight:bold;');
			//font.appendChild(myText);
			//msgElement.appendChild(font);
            
            // list messages
			var orderListElement = document.createElement("ol");
			
			//message 1                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg1)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));
			orderListElement.appendChild(document.createElement("br"));
			
			//message 2                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg2)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
			//message 3                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg3)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));	
			orderListElement.appendChild(document.createElement("br"));			                       
				                       
			msgElement.appendChild(orderListElement);
			//message 4                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg4)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
         
            // create popup message box
            var cutoffMsgElement = document.createElement("div");
            cutoffMsgElement.id = "cutoffmsg";
            
            // append header and message body to popup message box
            cutoffMsgElement.appendChild(headerElement);
            cutoffMsgElement.appendChild(msgElement);
            
            // append popup message box to body
            bodyElement.appendChild(cutoffMsgElement);
            
            // setup popup box location
            var LeftPosition = (screen.width) ? (screen.width-420)/2 : 0;
            var TopPosition = (screen.height) ? (screen.height-700)/2 : 0;
            
            // show up message box at desired location
            cutoffMsgElement.style.left = LeftPosition + "px";
            cutoffMsgElement.style.top = TopPosition + "px";
            cutoffMsgElement.style.display = "block";
            
            // make the popup window dragable
            DragHandler.attach(cutoffMsgElement);
        }  
  //--------------------------FUNCTION showPopup_CA----------------------------       
    function showPopup_CA() {
        
        //var period1 = true;
        //var period2 = true;
		var msgtitle;
		var msg1;
		var msg2;
		var msg3;
		var msg4;
		var msgbutton;
		var msgconfirm;
		var msgclose;
		
		var d = new Date();
		var day=d.getDate();
		var nextday=d.getDate()+1; //last day of the month
		var hours=d.getHours();
		var showmsg
		if (day>=28 && day<=31){ showmsg = 1;} 
		if (day==1 && hours<=12){ showmsg = 2;} 
		
		
       if (LangTag=="Fre") {
				if (showmsg==1){
					msg1="Sunrider IBOs, please be aware that all orders, Product Pack/Gift Set serial number transfers, and Sales Volume (SV) transfers made after 9:00 pm, PDST on the last day of the month will be applied to the next month,Wholesale Price Bonus cycle."
					msg2="For further information regarding the Wholesale Price Bonus please, contact the Business Services department at (310) 781-8096, M - F 8:00 am - 4:00 pm.";
					msg3="";
					msg4="";
				}
				
				else if (showmsg==2){				
					msg1="Important information!"
					msg2="Please note that all transactions entered in the system after 9 p.m. PDT. on the last day of the month will automatically be processed and counted with the next month’s SV.  Therefore,  to be counted for the current SV month: sponsoring, product purchases, SV transfers, Product Pack/Gift Set transfers, or any other transactions must be completed by 9 p.m., PDT.";
					msg4="If you have any questions regarding this issue, please email Business Service Reps at info@sunrider.com.  Thank you. ";
					msg3=""
				}	
					msgclose="Close";	
  
            }
       else{
			
				if (showmsg==1){
					msg1="Sunrider IBOs, please be aware that all orders, Product Pack/Gift Set serial number transfers, and Sales Volume (SV) transfers made after 9:00 pm, PDST on the last day of the month will be applied to the next month,Wholesale Price Bonus cycle."
					msg2="For further information regarding the Wholesale Price Bonus please, contact the Business Services department at (310) 781-8096, M - F 8:00 am - 4:00 pm.";
					msg3="";
					msg4="";
				}
				
				else if (showmsg==2){				
					msg1="Important information!"
					msg2="Please note that all transactions entered in the system after 9 p.m. PDT. on the last day of the month will automatically be processed and counted with the next month’s SV.  Therefore,  to be counted for the current SV month: sponsoring, product purchases, SV transfers, Product Pack/Gift Set transfers, or any other transactions must be completed by 9 p.m., PDT.";
					msg4="If you have any questions regarding this issue, please email Business Service Reps at info@sunrider.com.  Thank you. ";
					msg3=""
				}	
					msgclose="Close";	

       
       }          
		// check for DOM if all elements are ready to parse
        //if(document && document.getElementsByTagName && document.getElementById && document.body) {
            
            // search for body element     
            var bodyElement = document.getElementsByTagName("body")[0];
            
            // create header for popup message
            var headerElement = document.createElement("div");
            headerElement.id = "header";
            
            // create close tag
            var closeLink = document.createElement("div");
            closeLink.id = "closeTag";
            closeLink.onclick = closePopup;
            closeLink.appendChild(document.createTextNode(msgclose));
            
            headerElement.appendChild(closeLink);
           
       
          
            // create message title
            var msgElement = document.createElement("div");
           // msgElement.id = "msgbody";
           // msgElement.style.fontFamily = "Verdana";
           // msgElement.style.fontSize = "12px";
           // msgElement.style.padding = "10px";
		   //msgElement.style.margin = "auto";
           // msgElement.style.width = "95%";
           // msgElement.appendChild(document.createTextNode(msg1));
           
            // list messages
			var orderListElement = document.createElement("ol");
			
			//message 1                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg1)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));
			orderListElement.appendChild(document.createElement("br"));
			
			//message 2                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg2)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
			
			//message 3                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg3)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));	
			orderListElement.appendChild(document.createElement("br"));			                       	                       
			msgElement.appendChild(orderListElement);
			//message 4                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg4)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
         
            // create popup message box
            var cutoffMsgElement = document.createElement("div");
            cutoffMsgElement.id = "cutoffmsg";
            
            // append header and message body to popup message box
            cutoffMsgElement.appendChild(headerElement);
            cutoffMsgElement.appendChild(msgElement);
            
            // append popup message box to body
            bodyElement.appendChild(cutoffMsgElement);
            
            // setup popup box location
            var LeftPosition = (screen.width) ? (screen.width-420)/2 : 0;
            var TopPosition = (screen.height) ? (screen.height-700)/2 : 0;
            
            // show up message box at desired location
            cutoffMsgElement.style.left = LeftPosition + "px";
            cutoffMsgElement.style.top = TopPosition + "px";
            cutoffMsgElement.style.display = "block";
            
            // make the popup window dragable
            DragHandler.attach(cutoffMsgElement);
        } 
        
  //--------------------------FUNCTION showPopup_TW----------------------------       
    function showPopup_TW() {
        
        //var period1 = true;
        //var period2 = true;
		var msgtitle;
		var msg1;
		var msg2;
		var msg3;
		var msg4;
		var msgbutton;
		var msgconfirm;
		var msgclose;
	   	
       //if (LangTag=="Eng") {
           
					//msg1=""
					//msg2="For further information regarding the Wholesale Price Bonus please, contact the Business Services department at (310) 781-8096, M - F 8:00 am - 4:00 pm.";
					//msg3="";
					//msg4="";
					//msgclose="Close";
  
        //}
       //else
        if (LangTag=="Cht") {
			
					msg1="¥P©gÁ¢¼w¯S³\©±¥D, ©êºp¤½¥q¦b¤Q¤@¤ë¤½§G¿ù»~, »~¾É¯S³\©±¤£»Ý­nÁÊ¶R©Î¾P°â¤­­ÓÂ§²°, ¤½¥q¨Ã¨S¦³§ïÅÜÁÊ¶R©Î¾P°âÂ§²°ªº­n¨D, §Æ±æ¤j®aÄ~Äò¥HÂ§²°¤¶²Ðµ¹ÅU«È, ¥¿¾A¦X³¯³Õ¤hªº«Å¾É, ¥~¥Î·R½¬Å@½§Â§²°, ¤º¥Î¥Í¤§·½Â§²°, ¤º¥~¹F­P¥þ­±©Êªº¬üÄR, ¦h¥æªB¤Í, ¦h§ä·sÅU«È, Â§²°¬OÂ²³æªº²£«~»P¦A¥Í­õ²zªº¤¶²Ð, ¤½¥qªº¹q¸£³¡·|ÅýPOS¦¬»È¾÷¨t²ÎÀ°§U¤j®a¯à½æÂ§²°©Î¤À´²¾P°â. "
					msg2="¤Q¤G¤ë¤w¨ì¤¤¦¯, ¤Q¤G¤ëªº¼úª÷»P§Q¼í­pºâ, ¨S¦³Â§²°ªº­n¨D, ©Î2010¦~1¤ë¶}©l,©Ò¦³©±¾Q¥²¶·¨C¤ë¦³5­ÓÂ§²°, ¯¬¤j®a¦³¤@­Ó´r§Öªº¸`¤é";
					msg3="";
					msg4="";
					msgclose="Ãö³¬µ¡¤f";
  
           }          
         
		// check for DOM if all elements are ready to parse
        //if(document && document.getElementsByTagName && document.getElementById && document.body) {
            
            // search for body element     
            var bodyElement = document.getElementsByTagName("body")[0];
            
            // create header for popup message
            var headerElement = document.createElement("div");
            headerElement.id = "header";
            
            // create close tag
            var closeLink = document.createElement("div");
            closeLink.id = "closeTag";
            closeLink.onclick = closePopup;
            closeLink.appendChild(document.createTextNode(msgclose));
            
            headerElement.appendChild(closeLink);
           
                 
            // create message title
            var msgElement = document.createElement("div");
            //msgElement.id = "msgbody";
            //msgElement.style.fontFamily = "Verdana";
            //msgElement.style.fontSize = "12px";
            //msgElement.style.padding = "10px";
			//msgElement.style.margin = "auto";
            //msgElement.style.width = "95%";
            //msgElement.appendChild(document.createTextNode(msg1));
			//var myText = document.createTextNode(msg1);
			//var font = document.createElement("font");
			//font.setAttribute('style', 'font-weight:bold;');
			//font.appendChild(myText);
			//msgElement.appendChild(font);
            
            // list messages
			var orderListElement = document.createElement("ol");
			
			//message 1                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg1)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));
			orderListElement.appendChild(document.createElement("br"));
			
			//message 2                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg2)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
			//message 3                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg3)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));	
			orderListElement.appendChild(document.createElement("br"));			                       
				                       
			msgElement.appendChild(orderListElement);
			//message 4                 
			var listElement = document.createElement("");;
			listElement.className = "listItem";
			listElement.appendChild(
			document.createTextNode(msg4)); 
			orderListElement.appendChild(listElement); 
			orderListElement.appendChild(document.createElement("br"));			                       
			msgElement.appendChild(orderListElement);
         
            // create popup message box
            var cutoffMsgElement = document.createElement("div");
            cutoffMsgElement.id = "cutoffmsg";
            
            // append header and message body to popup message box
            cutoffMsgElement.appendChild(headerElement);
            cutoffMsgElement.appendChild(msgElement);
            
            // append popup message box to body
            bodyElement.appendChild(cutoffMsgElement);
            
            // setup popup box location
            var LeftPosition = (screen.width) ? (screen.width-420)/2 : 0;
            var TopPosition = (screen.height) ? (screen.height-700)/2 : 0;
            
            // show up message box at desired location
            cutoffMsgElement.style.left = LeftPosition + "px";
            cutoffMsgElement.style.top = TopPosition + "px";
            cutoffMsgElement.style.display = "block";
            
            // make the popup window dragable
            DragHandler.attach(cutoffMsgElement);
        }
         //--------------------------FUNCTION showPopup_HU----------------------------       
		function showPopup_HU() {
		    
		   if (LangTag=="Hng") {
		       

						msg1="Ez¨²ton ¨¦rtes¨ªtj¨¹k kedves ¨¹gyfeleinket, hogy a Sunrider weboldal¨¢n a rendel¨¦sfelv¨¦tel 2009. december 30. 00:00 ¨®r¨¢t¨®l 2010. janu¨¢r 4. 0:00 ¨®r¨¢ig karbantart¨¢s miatt sz¨¹netel. "
						//msg2="";
						//msg3="";
						//msg4="";
						msgclose="Close";
  
		    }
		   else if (LangTag=="Eng") {
		
						msg1="We would like to inform you about that our shop online will be closed until 0:00 a.m. 04/Jan/2010."
						//msg2="";
						//msg3="";
						//msg4="";
						msgclose="Close";
  
		       }          
        
			// check for DOM if all elements are ready to parse
		    //if(document && document.getElementsByTagName && document.getElementById && document.body) {
		        
		        // search for body element     
		        var bodyElement = document.getElementsByTagName("body")[0];
		        
		        // create header for popup message
		        var headerElement = document.createElement("div");
		        headerElement.id = "header";
		        
		        // create close tag
		        var closeLink = document.createElement("div");
		        closeLink.id = "closeTag";
		        closeLink.onclick = closePopup;
		        closeLink.appendChild(document.createTextNode(msgclose));
		        
		        headerElement.appendChild(closeLink);
		       
		             
		        // create message title
		        var msgElement = document.createElement("div");
		        //msgElement.id = "msgbody";
		        //msgElement.style.fontFamily = "Verdana";
		        //msgElement.style.fontSize = "12px";
		        //msgElement.style.padding = "10px";
				//msgElement.style.margin = "auto";
		        //msgElement.style.width = "95%";
		        //msgElement.appendChild(document.createTextNode(msg1));
				//var myText = document.createTextNode(msg1);
				//var font = document.createElement("font");
				//font.setAttribute('style', 'font-weight:bold;');
				//font.appendChild(myText);
				//msgElement.appendChild(font);
		        
		        // list messages
				var orderListElement = document.createElement("ol");
				
				//message 1                 
				var listElement = document.createElement("");;
				listElement.className = "listItem";
				listElement.appendChild(
				document.createTextNode(msg1)); 
				orderListElement.appendChild(listElement); 
				orderListElement.appendChild(document.createElement("br"));
				orderListElement.appendChild(document.createElement("br"));
				
				//message 2                 
				//var listElement = document.createElement("");;
				//listElement.className = "listItem";
				//listElement.appendChild(
				//document.createTextNode(msg2)); 
				//orderListElement.appendChild(listElement); 
				//orderListElement.appendChild(document.createElement("br"));			                       
				//msgElement.appendChild(orderListElement);
				//message 3                 
				//var listElement = document.createElement("");;
				//listElement.className = "listItem";
				//listElement.appendChild(
				//document.createTextNode(msg3)); 
				//orderListElement.appendChild(listElement); 
				//orderListElement.appendChild(document.createElement("br"));	
				//orderListElement.appendChild(document.createElement("br"));			                       
					                       
				msgElement.appendChild(orderListElement);
				//message 4                 
				//var listElement = document.createElement("");;
				//listElement.className = "listItem";
				//listElement.appendChild(
				//document.createTextNode(msg4)); 
				//orderListElement.appendChild(listElement); 
				//orderListElement.appendChild(document.createElement("br"));			                       
				//msgElement.appendChild(orderListElement);
		     
		        // create popup message box
		        var cutoffMsgElement = document.createElement("div");
		        cutoffMsgElement.id = "cutoffmsg";
		        
		        // append header and message body to popup message box
		        cutoffMsgElement.appendChild(headerElement);
		        cutoffMsgElement.appendChild(msgElement);
		        
		        // append popup message box to body
		        bodyElement.appendChild(cutoffMsgElement);
		        
		        // setup popup box location
		        var LeftPosition = (screen.width) ? (screen.width-420)/2 : 0;
		        var TopPosition = (screen.height) ? (screen.height-700)/2 : 0;
		        
		        // show up message box at desired location
		        cutoffMsgElement.style.left = LeftPosition + "px";
		        cutoffMsgElement.style.top = TopPosition + "px";
		        cutoffMsgElement.style.display = "block";
		        
		        // make the popup window dragable
		        DragHandler.attach(cutoffMsgElement);
		    }  
		              
 //--------------------------FUNCTION showPopup----------------------------       
    function showPopup() {
        
        //var period1 = true;
        //var period2 = true;
		var msgtitle;
		var msg1;
		var msgbutton;
		var msgconfirm;
		var msgclose;
 
       if (LangTag=="Kor") {
     	    msgtitle="»õ·Î¿î ÇÁ·£Â÷ÀÌÁî »ç¾÷ Âü°¡½ÅÃ»¼­";
		    msg1="º»ÀÎÀº ½ã¶óÀÌ´õÄÚ¸®¾Æ°¡ 2009³â 1¿ù 31ÀÏÀÚ·Î ´Ù´Ü°èÆÇ¸Å¾÷À» Æó¾÷ÇÔ¿¡ µû¶ó ±âÁ¸ÀÇ µ¶¸³ ºñÁî´Ï½º ¿À³Ê(´Ù´Ü°èÆÇ¸Å¿ø)·Î¼­ÀÇ ÁöÀ§°¡ ÇØÁöµÇ¸ç, 2¿ù 1ÀÏºÎÅÍ ½ÃÇàµÇ´Â ½ã¶óÀÌ´õÀÇ »õ·Î¿î ÇÁ·£Â÷ÀÌÁî »ç¾÷(°¡¸Í»ç¾÷)¿¡ Âü¿©ÇÏ±â¸¦ Èñ¸ÁÇÏ¸ç, ÀÌ¿¡ ½ÅÃ»ÇÕ´Ï´Ù.";
            msgbutton="½ÅÃ»ÇÏ±â"; 
			msgconfirm="½ÅÃ»ÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù."; 
			msgclose="´Ý±â";
  
            }
       else{
			msgtitle="New Franchise Business Application"
			msg1="I confirm that my existing Independent Business Ownership (MLM sales person) will be terminated according to closing MLM business of Sunrider Korea effective on January 31, 2009 and I wish to join Sunrider new franchise business so, I am applying on it.";
			msgbutton="Apply now"; 
			msgconfirm="Your application is successfully accepted."; 
			msgclose="Close";
       
       }          
		// check for DOM if all elements are ready to parse
        //if(document && document.getElementsByTagName && document.getElementById && document.body) {
            
            // search for body element     
            var bodyElement = document.getElementsByTagName("body")[0];
            
            // create header for popup message
            var headerElement = document.createElement("div");
            headerElement.id = "header";
            
            // create close tag
            var closeLink = document.createElement("div");
            closeLink.id = "closeTag";
            closeLink.onclick = closePopup;
            closeLink.appendChild(document.createTextNode(msgclose));
            
            headerElement.appendChild(closeLink);
           
       
            // create message title
            var msgElement = document.createElement("div");
            msgElement.id = "msgbody";
            msgElement.style.fontFamily = "Verdana";
            msgElement.style.fontSize = "12px";
            msgElement.style.padding = "10px";
            msgElement.style.margin = "auto";
            msgElement.style.width = "95%";
            msgElement.appendChild(document.createTextNode(msgtitle));
            
            // list messages
            //if(period1 || period2) {
                 var orderListElement = document.createElement("ol");
 
                 //message 1                 
                 var listElement = document.createElement("");;
                 listElement.className = "listItem";
                 listElement.appendChild(
                 document.createTextNode(msg1)); 
                 orderListElement.appendChild(listElement); 
                 orderListElement.appendChild(document.createElement("br"));
                  
                
                 //mybutton
                 mybutton=document.createElement("BUTTON");
				 mybutton.style.height=30
				 mybutton.style.width=85;
				 mybutton.value=msgbutton;
				 mybutton.onclick=myOnClick;
 
				//hyper link
				//var link = document.createElement ('A');
				//link.appendChild (document.createTextNode (msgbutton));
				//link.setAttribute ('href', 'home.asp?oksave=1');	
 				//link.onclick=myOnClick;


                      
                 msgElement.appendChild(orderListElement);
                 msgElement.appendChild(mybutton);
                 //msgElement.appendChild(link);
               

            //}
            
            // create popup message box
            var cutoffMsgElement = document.createElement("div");
            cutoffMsgElement.id = "cutoffmsg";
            
            // append header and message body to popup message box
            cutoffMsgElement.appendChild(headerElement);
            cutoffMsgElement.appendChild(msgElement);
            
            // append popup message box to body
            bodyElement.appendChild(cutoffMsgElement);
            
            // setup popup box location
            var LeftPosition = (screen.width) ? (screen.width-420)/2 : 0;
            var TopPosition = (screen.height) ? (screen.height-700)/2 : 0;
            
            // show up message box at desired location
            cutoffMsgElement.style.left = LeftPosition + "px";
            cutoffMsgElement.style.top = TopPosition + "px";
            cutoffMsgElement.style.display = "block";
            
            // make the popup window dragable
            DragHandler.attach(cutoffMsgElement);
        }    
   // }
 //--------------------------FUNCTION closePopup----------------------------           
    // remove popup message box
    function closePopup() {
        if(document.getElementById("cutoffmsg")) {
            var bodyElement = document.getElementsByTagName("body")[0];
            var removeTarget = document.getElementById("cutoffmsg");
            removeTarget.style.display = "none";
            
            bodyElement.removeChild(removeTarget);
            
        }
    

        
    }
    
/*************************************/
/*  Crossbrowser Drag & Drop Handler
/*************************************/
var DragHandler = {
    // private property
    _dragObj:   null,
    
    // publich method to register the handler to the event 
    attach:     function(targetObj) {
        targetObj.onmousedown = DragHandler._dragStart;
        return targetObj;
    },   
    
    // private methid to start the drag action
    _dragStart: function(e) {
          // initialize the dragable object
          DragHandler._dragObj = this;
          // create short name
          var targetObj = DragHandler._dragObj;
          
          // determine the initial object location
          if(isNaN(parseInt(targetObj.style.top)))
            targetObj.style.top = "0px";
          if(isNaN(parseInt(targetObj.style.left)))
            targetObj.style.left = "0px";
          
          // e = e : for firefox ; e = window.event : for IE
          e = e ? e : window.event;
          
          // determine the initial mouse location
          targetObj.mouseX = e.clientX;
          targetObj.mouseY = e.clientY;
          
          // register handler to events
          document.onmousemove = DragHandler._dragMove;
          document.onmouseup = DragHandler._dragEnd;
          
          // prevent browser default action (e.g. hightlight)
          return false;
    },
    
    // private method to unregister the event handlers
    _dragEnd:   function() {
        // unregister the handler and object
        document.onmousemove = null;
        document.onmouseup = null;
        DragHandler._dragObj = null;
    },
    
    // private method to update the object location 
    _dragMove:  function(e) {
        // create short name
        var targetObj = DragHandler._dragObj;
        
        // determine the current object location
        var top = parseInt(targetObj.style.top);
        var left = parseInt(targetObj.style.left);
        
        // e = e : for firefox ; e = window.event : for IE
        e = e ? e : window.event;
        
        // update the object location
        targetObj.style.top = top + (e.clientY - targetObj.mouseY) + "px";
        targetObj.style.left = left + (e.clientX - targetObj.mouseX) + "px";
        
        // update the mouse location
        targetObj.mouseX = e.clientX;
        targetObj.mouseY = e.clientY;
        
        // prevent browser default action (e.g. hightlight)
        return false;      
    }
};       