// JavaScript Document



function getXMLHttp()



{



 var xmlHttp = null;



 try



 {



  xmlHttp = new XMLHttpRequest();



 }



 catch(e)



 {







	 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;



		}



	 }



 }



 return xmlHttp;



}















function checklogin(user,pass,divid)



{







	if(user == "")



	{



		alert("Enter value in username field..");



		return false;



	} else if (pass == "")



	{



		alert("Enter value in password field..");



		return false;



	}







 var url ="login.php?user="+user+"&pass="+pass;







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()
 {
     if (xmlHttp.readyState == 4)
     {
        if(xmlHttp.responseText=="Success"){
             window.location.href="index.php";
        }else{
            if(xmlHttp.responseText=="inactive")
            {
                document.getElementById(divid).style.display="inline";
                document.getElementById(divid).innerHTML = "You need to activate your account before being able to login.";
            }else{
                document.getElementById(divid).style.display="inline";
                document.getElementById(divid).innerHTML = xmlHttp.responseText;
            }
        }
      }
 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}







function echeck(str) {







		var at="@"



		var dot="."



		var lat=str.indexOf(at)



		var lstr=str.length



		var ldot=str.indexOf(dot)



		if (str.indexOf(at)==-1){



		   alert("Invalid E-mail ID")



		   return false



		}







		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){



		   alert("Invalid E-mail ID")



		   return false



		}







		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){



		    alert("Invalid E-mail ID")



		    return false



		}







		 if (str.indexOf(at,(lat+1))!=-1){



		    alert("Invalid E-mail ID")



		    return false



		 }







		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){



		    alert("Invalid E-mail ID")



		    return false



		 }







		 if (str.indexOf(dot,(lat+2))==-1){



		    alert("Invalid E-mail ID")



		    return false



		 }



		



		 if (str.indexOf(" ")!=-1){



		    alert("Invalid E-mail ID")



		    return false



		 }







 		 return true					



	}





function sendmail11(useremail1, divid)

{

    if( useremail1 == "")

    {

       alert("Please enter valid email id.");

       return false;

    } else if (echeck(useremail1)==false)     {

        return false;

    }



    //var url = "http://www.techfortune.co.in/demos/Gigrr/forget.php?useremail="+useremail1;
	var url = "forget.php?useremail="+useremail1;

    window.location.href = url;

    alert("Validating entered email in our system....");

    window.setTimeout('window.close()', 1000);

}





function userregister(useremail1,username1,pass1, no1){



	if( useremail1 == "")



	{



	   alert("Please enter valid email id.");



		useremail1.focus();



	   return false;



	} else if (echeck(useremail1)==false) 	{



		useremail1.focus();



		return false;



	} else if ( username1 == "" ) {



	   alert("Please enter username.");



	   username1.focus();



	   return false;



	}  else if ( pass1 == "") {



		alert("Please enter password.");



		pass1.focus();



	    return false;



	} else if (no1 == "")



	{



		alert("Please enter number.");



		no1.focus();



	    return false;



	}







	











 var url = "register.php?useremail1="+useremail1+"&username1="+username1+"&pass1="+pass1;







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







 	







	if(xmlHttp.responseText=="Success")







	{







		 alert("Registration Successfull! Please check mail for activation Link !");







		 window.location.href="index.php";







	}







	else if(xmlHttp.responseText=="UnSuccess")







 	{







		 alert("Email or Username already exists with us!");







		 window.location.href="index.php";







	}	







  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}























function addsuggest(s,c)







{







 var url = "suggest.php?suggession="+s+"&catid="+c;



 var xmlHttp = getXMLHttp();



 try 



 {



 if( s == "" )



	 {



	 	alert("Please enter text in suggest box....");	



	 	return false;



	 }



	 xmlHttp.onreadystatechange = function()



	 {



		 if (xmlHttp.readyState == 4) 



 		{



			if(xmlHttp.responseText == "Suggestion") 



			{



 			alert("Suggestion posted successfully....");



   			//return false;



			}



			else



			{



			   //alert("Login First for Suggesstion!");



		   return false;



			}



		 }



	 }



	xmlHttp.open("GET", url, true);



 	xmlHttp.send(null); 	 



 }



 catch(err)



 {



 	alert(err);



 }







}























function showHideDiv(divID)







    {

       var divstyle = new String();

       divstyle = document.getElementById(divID).style.display;







		







		if(divstyle.toLowerCase()=="inline" || divstyle == "")







        {







            document.getElementById(divID).style.display = "none";







        }







        else







        {







            document.getElementById(divID).style.display= "inline";







        }		  







  }























function userlike(gig,x,divid,y)







{











var url ="userlike.php?gig="+gig+"&check="+x+"&index="+y;







//alert(url);







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







	//showHideDiv(like);







	//showHideDiv(ulike);







	//window.location.href="index.php";







	document.getElementById(divid).innerHTML = xmlHttp.responseText;



	



  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}















function indexcategoryload(val)







{







window.location.href="categorygigs.php?category=&mny="+val;























 /*







for(i=0;i<document.all('mnycat').length;i++)







{







if(document.all('mnycat').options[i].value==val)







{







document.all('mnycat').selectedIndex=i















}























}*/







//document.getElementyByName('mnycat').value=val;







}















function categoryloadcat(val,cat)















{















 window.location.href="categorygigs.php?category="+cat+"&mny="+val;







}















function searchres(txt)







{















 var url ="searchresult.php?text="+txt;







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







	window.location.href="searchresult.php?text="+txt;







  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}















function example_ajax_request(imgurl,divid)







{







var url="loadimage.php?imgurl="+imgurl;







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







  $('#'+divid).html('<p><img src="images/loading.gif" /></p>');







  //$('#example-placeholder').load('loadimage.php');







  document.getElementById(divid).innerHTML = xmlHttp.responseText;







  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







  







}















function feedback12(feedtext,id,g1)







{







	if(feedtext == "")







	{







		alert("Please enter feedback comments.");	







		return false;







	}







	for(i=0; i<=g1.length-1; i++){







		if(g1[i].checked)







		{







			flag = g1[i].value;	







		} 







	}







 







 var url="feedback.php?feed="+feedtext+"&catid="+id+"&r1="+flag;















 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







	if(xmlHttp.responseText == "Fail")







	 {







		alert("Please Login first for Feedback!");







		return false;







	 }







	 else







	 {







    window.location.href="gig_desc.php?No="+id;







	 }







  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







  







}







function exportdatabase()







{







var url="exportdata.php";







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {







  //$('#'+divid).html('<p><img src="images/loading.gif" /></p>');







  //$('#example-placeholder').load('loadimage.php');







  //document.getElementById(divid).innerHTML = xmlHttp.responseText;







  if(xmlHttp.responseText=="Success")







  {







	  alert("Database Exported Successfully!");







  }







  else







  {







	  alert("Some problem occures during Export!");







  }







  }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







  







}







function checkForm(thisform)







{







       if(thisform == "" || thisform == null) {







          alert("Please select a file to upload");







          return false;







      } else {







		  var s= thisform.split(".");







		  if(s[1]!="jpg" && s[1]!="jpeg" && s[1]!="gif")







		  {







		  //validformFile = /(.jpg|.JPG|.gif|.GIF)$/;







          //if(validformFile.test(thisform)){







            alert("Only image files are supported. Please try again");







             return false;







          }







      }







     return true;







    }







function validate_captcha(val1,val2)







{







 if(val1!= val2)







 {







	  alert("Please enter valid captcha");







	  return false;







 }















}



function loaduserinbox(userid)



{







 var url ="inbox_user.php?uid="+userid;







 var xmlHttp = getXMLHttp();







 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {



		document.getElementById('userinbox').innerHTML = xmlHttp.responseText;



 }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}



function cancelorder(code,gigid)



{



 var url ="cancelorder.php?ordercode="+code+"&gid="+gigid;



var xmlHttp = getXMLHttp();

 try 







 {







 xmlHttp.onreadystatechange = function()







 {







 if (xmlHttp.readyState == 4) 







 {

	 

	   if(xmlHttp.responseText == 'Cancel' )  

		{

		alert('Order Cancelled Successfully !');

		window.location.href="order.php";

		}

//		document.getElementById('userinbox').innerHTML = xmlHttp.responseText;



 }







 }







 xmlHttp.open("GET", url, true);







 xmlHttp.send(null);







 }







 catch(err)







 {







 alert(err);







 }







}

	

	


