//
function show_hide_fun(div){
	if(document.getElementById(div).style.display=="none" ){
		document.getElementById(div).style.display="block";
 	}else{
		document.getElementById(div).style.display="none";
 	}
}
 
//disapper text 
function text_disappear(default_val,element){
 	var val=document.getElementById(element).value;   //alert(val);
	if(val==default_val){
		document.getElementById(element).value='';
	}
 }
//
 

//
 function do_Logout()
{
	var choice=confirm("Are you sure want to Logout ?");
	if(choice!=false)
	{
		window.top.location.href="logout.php";
	}
}
//
function numbersonly(e)
	{
		var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode!=8)
		{ //if the key isn't the backspace key (which we should allow)
			if (unicode<48||unicode>57) //if not a number
			return false; //disable key press
		}
		return true;
	}

// character count 
function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function ChkEmail(frmName,strEmail)
{
	var re;
	var FormName;
	var FldName;
	FormName=frmName;
	FldName=strEmail;
	re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
	var str=eval("document."+FormName+"."+FldName+".value");
	if (re.test(str) == false)
	{
	alert("That is not a valid Email address. Please enter again. ");
	eval("document."+FormName+"."+FldName+".focus()");
	eval("document."+FormName+"."+FldName+".select()");
	return false;
	}
}


 

function ajax_common(id,div,page_name,action){
	var ajaxRequest;  // The variable that makes Ajax possible!
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(div);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			 
		} 
	}
	 
	//var countryname=document.getElementById('Country').value; 
	document.getElementById(div).innerHTML="<b><font color='#000000'>LOADING....</font></b>";
	var queryString = page_name+"?id="+id+"&action="+action+"&div="+div ;
	ajaxRequest.open("GET",  queryString, true);
	
	ajaxRequest.send(null);  
	
	divwin.hide();  /*document.getElementById(divnum).style.visibility = "hidden";*/
 
}


function ajax_submit_order(aid,photo_id,div,page_name,action){
	var ajaxRequest;  // The variable that makes Ajax possible!
 	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(div);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			 
		} 
	}
	 
	//var countryname=document.getElementById('Country').value; 
	 
	 var quantity=document.getElementById('quantity'+photo_id).value;
	 var pic_size=document.getElementById('pic_size'+photo_id).value;
	 
	 var album=document.getElementById('album'+photo_id).value;
	 var album_size=document.getElementById('album_size'+photo_id).value;
	 var frame=document.getElementById('frame'+photo_id).value;
	 var paper=document.getElementById('paper'+photo_id).value;
	 var paper_size=document.getElementById('paper_size'+photo_id).value;
	 
	document.getElementById(div).innerHTML="<b><font color='#000000'>Processing	....</font></b>";
	var queryString = page_name+"?aid="+aid+"&action="+action+"&div="+div+"&photo_id="+photo_id+"&quantity="+quantity+"&pic_size="+pic_size+"&album="+album+"&album_size="+album_size+"&frame="+frame+"&paper="+paper+"&paper_size="+paper_size  ;
	ajaxRequest.open("GET",  queryString, true);
	
	ajaxRequest.send(null);  
	
	
 
}

function ajax_album(photo_id,div,page_name,action){
	var ajaxRequest;  // The variable that makes Ajax possible!
 	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(div);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			 
		} 
	}
	 
  	 var album=document.getElementById('album'+photo_id).value; //alert(album);
 	 
	 
	document.getElementById(div).innerHTML="<b><font color='#000000'>Processing	....</font></b>";
	var queryString = page_name+"?album="+album+"&photo_id="+photo_id+"&action="+action;
	ajaxRequest.open("GET",  queryString, true);
	
	ajaxRequest.send(null);  
	
	
 
}

function ajax_paper(id,photo_id,div,page_name,action){
	var ajaxRequest;  // The variable that makes Ajax possible!
 	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(div);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			 
		} 
	}
	 
  	 
 	 
	 
	document.getElementById(div).innerHTML="<b><font color='#000000'>Processing	....</font></b>";
	var queryString = page_name+"?photo_id="+photo_id+"&action="+action+"&id="+id;
	ajaxRequest.open("GET",  queryString, true);
	
	ajaxRequest.send(null);  
	
	
 
}

 
