/*var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")*/


/***************************************************************************************************
***************************************************************************************************

Function Name 	:- register
Developed By 	:- Aakash Malik
Date 			:- 18-08-2009
Parameter 		:- Title is a parameter here 
Description		:- This Function is for Subscriber and Unsbuscribed for news letter from site.

***************************************************************************************************
***************************************************************************************************/

function register(val){
				
				var formstr = '<form name="fmfrnd" method="GET">'+'<p align="center" class="title">'+ val +' to Our Newsletter</p>'+
							'<div align="center">'+
							'<div class="field"><label for="uname">Name <font color="#f00"> * </font> </label><input type="text" name="urname" id="urname" value="" style="width:300px;"/></div>'+
							'<div class="field"><label for="uemail">Email <font color="#f00"> * </font></label><input type="text" name="uremail" id="uremail" value="" style="align:left; width:300px; " /></div>'+
							'</div>'+'</form>';

				jqistates = {
					state0: {
						html: formstr,
						focus: 1,
						buttons: { Close: false, "Send Request": true },
						submit: function(v, m, f){
							var e = "";
							m.find('.errorBlock').hide('fast',function(){ $(this).remove(); });
							
							if (v) {
								
								if(f.urname=="")
									e += "Please enter Your Name!<br />";

								if(f.uremail=="")
									e += "Please enter Your Email Address!<br />";
								
								if(f.uremail != "")
								{
									if(f.uremail.indexOf("@")==-1 || f.uremail.indexOf(".")==-1 || f.uremail.indexOf(" ")!=-1)
									{
										e += "Invalid Email Address. Please Enter Your Email Address Again!<br />";
									}
								}

								
								
								if (e == "") 
								{
										
									var url;
									url="subscribe.php";
									//url=url+"?events="+f.events_items+"&email="+f.uremail+"&name="+f.urname+"&company="+f.company+"&tel="+f.tel+"&fax="+f.fax+"&die="+f.die+"&msg="+f.msg+"&brand="+f.brands+"&service="+f.service;
									url=url+"?email="+f.uremail+"&name="+f.urname+"&subs="+val;
								
									var xmlHttp;
									try
									{  
									// Firefox, Opera 8.0+, Safari 
										 xmlHttp=new XMLHttpRequest();  
									}
									catch (e)
									{ 
									 // Internet Explorer  
										try
										{    
											xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
										}
										catch (e)
										{    
											try
											{     	
												xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
											}
											 catch (e)
											 {      
												  alert("Your browser does not support AJAX!");
												  return false;  
											 }
										}
									  }
									  xmlHttp.onreadystatechange=function()
									  {
										if(xmlHttp.readyState==4)
										{
											xx=xmlHttp.responseText;
											$.prompt.getStateContent('state1').find('#response').text(xx);		
											$.prompt.goToState('state1');
										}
									  }
									  xmlHttp.open("POST",url,true);
									  xmlHttp.send(null);	
									
								}
								else{
									$('<div class="errorBlock" style="display: none;">'+ e +'</div>').prependTo(m).show('slow');
								}
								return false;
							}
							else return true;
						}
					},
					state1: {
						html: '<div id="response" style="text-align:center;"></div>',
						focus: 1,
						buttons: { Back: false, Done: true },
						submit: function(v,m,f){
							if(v)
								return true;
								
							$.prompt.goToState('state0');
							return false;
						}
					}
				};
				
				$.prompt(jqistates);
}



/***************************************************************************************************
***************************************************************************************************

Function Name 	:- AddTesti
Developed By 	:- Aakash Malik
Date 			:- 18-08-2009
Parameter 		:- No Parameter Here 
Description		:- This Function is for Adding a new Testimonial from User.

***************************************************************************************************
***************************************************************************************************/

function AddTesti(){
				
				var formstr = '<form name="fmfrnd" method="GET">'+'<p align="center" class="title">Add Your Own Testimonial</p>'+
							'<div align="center">'+
							'<div class="field"><label for="uname">Name <font color="#f00">  </font> </label><input type="text" name="urname" id="urname" value="" style="width:400px;"/></div>'+
							'<div class="field"><label for="title">Title <font color="#f00">  </font> </label><input type="text" name="title" id="title" value="" style="width:400px;"/></div>'+
							'<div class="field"><label for="company">Company <font color="#f00">  </font> </label><input type="text" name="company" id="title" value="" style="width:400px;"/></div>'+
							'<div class="field"><label for="uemail">Testimonial <font color="#f00">  </font></label> <textarea name="testi" rows="5" style="width:400px"></textarea>  </div>'+
							'</div>'+'</form>';

				jqistates = {
					state0: {
						html: formstr,
						focus: 1,
						buttons: { Close: false, "Add Testimonial": true },
						submit: function(v, m, f){
							var e = "";
							m.find('.errorBlock').hide('fast',function(){ $(this).remove(); });
							
							if (v) {
								
								if(f.urname=="")
									e += "Please enter Your Name!<br />";
								if(f.title=="")
									e += "Please enter Title!<br />";
								if(f.company=="")
									e += "Please enter Company Name!<br />";


								if(f.testi=="")
									e += "Please enter Your Testimonial Details!<br />";
								
								if (e == "") 
								{
									var url;
									url="submit_testi.php";
									url=url+"?name="+f.urname+"&title="+f.title+"&company="+f.company+"&testi="+f.testi;
								
									var xmlHttp;
									try
									{  
									// Firefox, Opera 8.0+, Safari 
										 xmlHttp=new XMLHttpRequest();  
									}
									catch (e)
									{ 
									 // Internet Explorer  
										try
										{    
											xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
										}
										catch (e)
										{    
											try
											{     	
												xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
											}
											 catch (e)
											 {      
												  alert("Your browser does not support AJAX!");
												  return false;  
											 }
										}
									  }
									  xmlHttp.onreadystatechange=function()
									  {
										if(xmlHttp.readyState==4)
										{
											xx=xmlHttp.responseText;
											$.prompt.getStateContent('state1').find('#response').text(xx);		
											$.prompt.goToState('state1');
										}
									  }
									  xmlHttp.open("POST",url,true);
									  xmlHttp.send(null);	
									
								}
								else{
									$('<div class="errorBlock" style="display: none;">'+ e +'</div>').prependTo(m).show('slow');
								}
								return false;
							}
							else return true;
						}
					},
					state1: {
						html: '<div id="response" style="text-align:center;"><div id="respond" style="text-align:center;"></div></div>',
						focus: 1,
						buttons: { Back: false, Done: true },
						submit: function(v,m,f){
							if(v)
								return true;
								
							$.prompt.goToState('state0');
							return false;
						}
					}
				};
				
				$.prompt(jqistates);
}


/***************************************************************************************************
***************************************************************************************************

Function Name 	:- viewtesti
Developed By 	:- Aakash Malik
Date 			:- 18-08-2009
Parameter 		:- Name of Person (who wrote this testi), Id of testi and Date 
Description		:- This Function is for Displaying testimonial which is clicked by client to views.

***************************************************************************************************
***************************************************************************************************/

function viewtesi(tid, name, tdate){
				
				var formstr='<form name="fmfrnd" method="GET">'+'<p align="center" class="title">Testimonial By ' + name + ' Posted On ' + tdate + '</p>'+
							'<div align="left" id="testimonial"></div>'+'</form>';
					
				var url;
				url="submit_testi.php";
				url=url+"?tid="+tid;
			
				var xmlHttp;
				try
				{  
				// Firefox, Opera 8.0+, Safari 
					 xmlHttp=new XMLHttpRequest();  
				}
				catch (e)
				{ 
				 // Internet Explorer  
					try
					{    
						xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
					}
					catch (e)
					{    
						try
						{     	
							xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
						}
						 catch (e)
						 {      
							  alert("Your browser does not support AJAX!");
							  return false;  
						 }
					}
				  }
				  xmlHttp.onreadystatechange=function()
				  {
					if(xmlHttp.readyState==4)
					{
						xx=xmlHttp.responseText;
						document.getElementById('testimonial').innerHTML = xx;									
					}
				  }
				  xmlHttp.open("POST",url,true);
				  xmlHttp.send(null);	
				
				jqistates = {
					state0: {
						html: formstr,
						focus: 1,
						buttons: { Close: false},
						submit: function(v, m, f){
							var e = "";
							m.find('.errorBlock').hide('fast',function(){ $(this).remove(); });
							
							if (v) {
								if (e == "") 
								{
								}
								else{
									$('<div class="errorBlock" style="display: none;">'+ e +'</div>').prependTo(m).show('slow');
								}
								return false;
							}
							else return true;
						}
					},
					state1: {
						html: '<div id="response" style="text-align:center;"><div id="respond" style="text-align:center;"></div></div>',
						focus: 1,
						buttons: { Back: false, Done: true },
						submit: function(v,m,f){
							if(v)
								return true;
								
							$.prompt.goToState('state0');
							return false;
						}
					}
				};
				
				$.prompt(jqistates);
}

