function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();  } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
	};
	
////////////////////////////////////////////////////////////////////////////////////////////////////////
function show_img(module,img) {

     var req=Inint_AJAX(); 
    
	 document.getElementById("show_pic").innerHTML='<div align="center"><img src="images_mod/loading-net.gif" alt="loading"><br><font color="#FF9900">Loading...</font></div>';
	 req.onreadystatechange = function () {
		  if (req.readyState==4) {
               if (req.status==200) {
				    var data=req.responseText;
				    document.getElementById("show_pic").innerHTML="<img src='mod_resize_img.php?w=270&h=270&img=images/"+img+"'>";
               }
          }
     };
     req.open("GET", module, true);
   	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
 
	 req.send(null);
	 
}



////////////////////////////////////////////////////////////////////////////////////////////////////////


var msgtop=50 // Set the top position of the div
var msgleft=20 // Set the left position of the div

var tborder="0"
var cspace="0"
var cpad="0"
var tabheight=200 // Set the height of table
var tabwidth=480 // Set the width of table
var td1height=10
var td2height=30
var boxt=""

		function Err_Message()
		{
			
			var  msgtext = "<br>ERROR...."
			theString="<TABLE WIDTH='"+tabwidth+"' HEIGHT='"+tabheight+"' BORDER="+tborder+" CELLSPACING="+cspace+" CELLPADDING="+cpad+" class='setdiv'><TR><TD HEIGHT='"+td1height+"' CLASS='td1style' ALIGN='center'><B>"
			theString+=""+msgtext+"</B><br><br><div align='center'><A HREF='javascript:hidebox()' class='linkstyle'><img src='images_mod/ok.gif' border='0' title='O.K'></A></div><br></TD></TR></TABLE>"
			
			if (document.layers) // Netscape 4.0+
			{
				document.formbox.document.write(theString)
				document.formbox.document.close()
				document.formbox.left=msgleft
				document.formbox.top=msgtop+40
				document.formbox.visibility="show"
			}
			else
			{
				if(document.getElementById) // Internet Explorer 5.0+ and Netscape 6.0+
				{
					elm=document.getElementById("formbox")
					elm.innerHTML=theString
					elm.style.top=msgtop
					elm.style.left=msgleft
					elm.style.visibility = "visible"
				}
			}
		}
		
		function hidebox()
		{
				if (document.layers) // Netscape 4.0+
				{  document.formbox.visibility="hidden" }
				if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
				{ elm.style.visibility="hidden" }
		}


////////////////////////////////////////////////////////////////////////////////////////////////////////

function show_certificate(module) {

     var req=Inint_AJAX(); 
    
	 document.getElementById("show_cer").innerHTML='<div align="center"><br><br><font color="#FF9900">Loading Certificate ...</font></div>';
	 req.onreadystatechange = function () {
		  if (req.readyState==4) {
               if (req.status==200) {
				      var data=req.responseText;
			          document.getElementById("show_cer").innerHTML=data;
			   }
          }
     };
     req.open("GET", module+"?ck="+new Date().getTime() + Math.random(), true);
   	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
 
	 req.send(null);
	 
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
function show_valid_send(module,q_mail,q_name,q_message,q_hidden,re_capchar,capchar_hid) {

     var req=Inint_AJAX(); 
	 document.getElementById("send_question_bg").innerHTML='<div align="center"><br><br><font color="#FFFFFF">Loading...</font></div>';
	 req.onreadystatechange = function () {
		  if (req.readyState==4) {
               if (req.status==200) {
				      var data=req.responseText;
			          document.getElementById("send_question_bg").innerHTML=data;
			   }
          }
     };

	 		 req.open("POST", module+"?ck="+new Date().getTime() + Math.random(), true);
			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
		
			 req.send("&question_mail="+q_mail+"&question_name="+q_name+"&question_message="+q_message+"&question_hidden="+q_hidden+"&re_capchar="+re_capchar+"&capchar_hid="+capchar_hid);

	 
}

//////////////////

function sendRequestLink(module,valid) {

     var req=Inint_AJAX(); 
    //if(document.form_question.question_mail.value==""){ alert('Please insert yoru E-Mail'); return false;}
	//if(document.form_question.question_message.value==""){ alert('Please insert yoru Message'); return false;
		   var  question_mail=escape(document.getElementById("question_mail").value);
	       var  question_name=escape(document.getElementById("question_name").value);  
	       var  question_message=escape(document.getElementById("question_message").value);
	       var  question_hidden=escape(document.getElementById("question_hidden").value);
		   
		   var re_capchar=escape(document.getElementById("re_capchar").value);
		   var capchar_hid=escape(document.getElementById("capchar_hid").value);
		   
	if(document.form_question.question_mail.value=="" || document.form_question.question_message.value=="" || document.form_question.re_capchar.value != document.form_question.capchar_hid.value){   
		   		
				 var mod=valid+question_hidden;
		   		 show_valid_send(mod,question_mail,question_name,question_message,question_hidden,re_capchar,capchar_hid);  

	} else {

			 document.getElementById("send_question_bg").innerHTML='<div align="center"><br><br><img src="images_mod/loading_liferay.gif" alt="loading"><br><br><font size="4" color="#FFFFFF">Sending...</font></div>';
			 
			 req.onreadystatechange = function () { 
				  if (req.readyState==4) { 
					   if (req.status==200) { 
								document.getElementById("send_question_bg").innerHTML="<div align=\"right\"><a href=\"javascript:;\" onclick=\"closeMessage();\"><img src=\"images_mod/closelabel_s.gif\" border=\"0\"></a></div>"
								+"<br><br><br><br><div align=\"center\"><h1><font color=\"#FFFFFF\">Thank you.<br>Your Message has been sent.</font></h1>"; 
					   }
				  }
			 }
			 req.open("POST", module+"?ck="+new Date().getTime() + Math.random(), true);
			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
		
			 req.send("&question_mail="+question_mail+"&question_name="+question_name+"&question_message="+question_message+"&question_hidden="+question_hidden+"&re_capchar="+re_capchar+"&capchar_hid="+capchar_hid);

  } /// end
	 
}
////////////////////////////////////////////////////////////////////////////////////////////////////////

function choose_certificate(pic,id){
	show_certificate('View_Default');
	document.getElementById("certificate_selected").value=id;
	document.getElementById("show_certificate_selected").innerHTML="<img src=\"images_lab/"+pic+"\"><hr>";
}


////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////
function show_valid_send_contact(module,q_mail,q_name,q_message,re_capchar,capchar_hid) {

     var req=Inint_AJAX(); 
	 document.getElementById("contact_bg").innerHTML='<div align="center"><br><br><font color="#FFFFFF">Loading...</font></div>';
	 req.onreadystatechange = function () {
		  if (req.readyState==4) {
               if (req.status==200) {
				      var data=req.responseText;
			          document.getElementById("contact_bg").innerHTML=data;
			   }
          }
     };

	 		 req.open("POST", module+"?ck="+new Date().getTime() + Math.random(), true);
			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
		
			 req.send("&question_mail="+q_mail+"&question_name="+q_name+"&question_message="+q_message+"&re_capchar="+re_capchar+"&capchar_hid="+capchar_hid);

	 
}

//////////////////

function sendRequestLink_contact(module,valid) {

     var req=Inint_AJAX(); 
	
    //if(document.form_question.question_mail.value==""){ alert('Please insert yoru E-Mail'); return false;}
	//if(document.form_question.question_message.value==""){ alert('Please insert yoru Message'); return false;
		   var  question_mail=escape(document.getElementById("question_mail").value);
	       var  question_name=escape(document.getElementById("question_name").value);  
	       var  question_message=escape(document.getElementById("question_message").value);
	       
		   
		   var re_capchar=escape(document.getElementById("re_capchar").value);
		   var capchar_hid=escape(document.getElementById("capchar_hid").value);
		   
	if(document.form_question.question_mail.value=="" || document.form_question.question_message.value=="" || document.form_question.re_capchar.value != document.form_question.capchar_hid.value){   
		   		
				 var mod=valid;
		   		 show_valid_send_contact(mod,question_mail,question_name,question_message,re_capchar,capchar_hid);  

	} else {

			 document.getElementById("contact_bg").innerHTML='<div align="center"><br><br><img src="images_mod/loading_liferay.gif" alt="loading"><br><br><font size="4" color="#FFFFFF">Sending...</font></div>';
			 
			 req.onreadystatechange = function () { 
				  if (req.readyState==4) { 
					   if (req.status==200) { 
								document.getElementById("contact_bg").innerHTML="<div align=\"right\"><a href=\"javascript:;\" onclick=\"closeMessage();\"><img src=\"images_mod/closelabel_s.gif\" border=\"0\"></a></div>"
								+"<br><br><br><br><div align=\"center\"><h1><font color=\"#FFFFFF\">Thank you.<br>Your Message has been sent.</font></h1>"; 
					   }
				  }
			 }
			 req.open("POST", module+"?ck="+new Date().getTime() + Math.random(), true);
			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
		
			 req.send("&question_mail="+question_mail+"&question_name="+question_name+"&question_message="+question_message+"&re_capchar="+re_capchar+"&capchar_hid="+capchar_hid);

  } /// end
	 
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
function show_EbayListing(module) {

     var req=Inint_AJAX(); 
    
	 document.getElementById("showEbayListing").innerHTML='<div align="center"><br><br><img src="http://odysseygem.com/Gem_Shop/images_mod/ajax-loader-red.gif"><br/><span style="color:#999;">Loading From eBay</span></div>';
	 req.onreadystatechange = function () {
		  if (req.readyState==4) {
               if (req.status==200) {
				      var data=req.responseText;
			          document.getElementById("showEbayListing").innerHTML=data;
			   }
          }
     };
     req.open("GET", module+"mod_listing_box_ebay.php?ck="+new Date().getTime() + Math.random(), true);
   	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8 ");		   
 
	 req.send(null);
	 
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
