<!--

function doCheck() {
			
	var day = document.getElementById("ageCheckDay").value;
	var month = document.getElementById("ageCheckMonth").value;
	var year = document.getElementById("ageCheckYear").value;
	var dob = new Date(month + "/" + day + "/" + year);
	var dateToCompare = new Date();
	dateToCompare.setDate(dateToCompare.getDate() - (365 * 18))

	
	if (dob < dateToCompare) { 
	
		update_data_ajax ('agecheck', 'doagecheck', '1'); 
		closeModal();
	
	} else {
		alert("Sorry you need to be 18 to enter this site.");	
	}
			
}

function checkValue(type) {
	
	switch(type) {
		
		case "day":
			day = document.getElementById("ageCheckDay").value;
			if(day.length == 2)
				document.getElementById("ageCheckMonth").focus();
		
		break;
		
		case "month":
			day = document.getElementById("ageCheckMonth").value;
			if(day.length == 2)
				document.getElementById("ageCheckYear").focus();
		break;
		
	}
}

function request_photo_resize(idd,single,target){
	var pp = 'w='+idd;
	
	//var pp ="w=200&h=200&q=80&1.jpg&nf=2.jpg&a=true"
	
	var url = "/ajax/ResizeImage.aspx";
	//alert(idd)
	var post = pp;
	var opt = {
		// Use POST
		method: 'post',
		// Send this lovely data
		postBody:post ,
		// Handle successful response
		onSuccess: function(t) {
		//Element.update(target,t.responseText);
			if(single=="true"){
				//reloadNow(target);
			}else{
				//reloadImages(target);
			}
		},
		// Handle 404
		on404: function(t) {
			debug.innerHTML = ('Error 404: location "' + t.statusText + '" was not found.');
		},
		// Handle other errors
		onFailure: function(t) {
			debug.innerHTML = ('Error ' + t.status + ' -- ' + t.statusText + ' -- '+t.responseText);
		}
	}

 	//alert(opt.toString());
	new Ajax.Request(url, opt);
	}	

function MP_openBrWindow(theURL,winName,features, wid, hei) {//v2.0 modified
LeftPosition = (screen.width) ? (screen.width-wid)/2 : 0;
TopPosition = (screen.height) ? (screen.height-hei)/2 : 0; 
featuresAll = features + ',top ='+TopPosition+',left='+LeftPosition
  window.open(theURL,winName,featuresAll);
}

var m = "";

function openModal(l){
//alert("openmodal")
m = new Control.Modal($(l), {
		overlayOpacity: 0.80,
		opacity:0.8,
		fade: true,
		overlayCloseOnClick: false
	});
m.open();
}

function closeModal(){
m.close();
//m.destroy();
	var flashMovie=getFlashMovieObject("banner");
	if(flashMovie != null)
	    flashMovie.callFlashReplay();
}

function getFlashMovieObject(movieName){
	if (window.document[movieName]){
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	}
	else{
		return document.getElementById(movieName);
	}
}

function cleanModal(){
$('control_window_2').remove();
//$('control_overlay').remove();
}
	
function replaceModal(action, target, idd){
	
	var pp = 'id='+idd;
//alert(action);
	var url = action;
//alert(idd)
	//Element.update(target,'<img src=\"ajax/indicator_flower.gif\" />   Loading, Please Wait...       [ <a href=\"javascript:window.location.href = window.location.href;\">Reload This Page</a> ]');
	pp = pp.toQueryParams();
	//alert(pp.toString());
	var post = Object.toQueryString(pp);
//	alert(post)
var opt = {
    // Use POST
    method: 'post',
    // Send this lovely data
    postBody:post ,
    // Handle successful response
    onSuccess: function(t) {
	Element.update(target,t.responseText);
    },
    // Handle 404
    on404: function(t) {
        debug.innerHTML = ('Error 404: location "' + t.statusText + '" was not found.');
    },
    // Handle other errors
    onFailure: function(t) {
        debug.innerHTML = ('Error ' + t.status + ' -- ' + t.statusText + ' -- '+t.responseText);
    }
}

 //alert(opt.toString());
new Ajax.Request(url, opt);

	}
	
	
//######################################################	
		
var valid

	function set_form_validation(formid){

	valid = new Validation(formid);//, {immediate : true});
	
	}

function submit_form_ajax(form_id, update_div, action, after_action, target, validate) {
//validate form

Element.update('debug','')

if (validate) {
	if (typeof(valid) != "undefined") {
		if (!valid.validate()){
		valid.reset()
		return false;
		}
	}
}

	var url = "/ajax/ajax.asp?a="+action;

try{
$(target).update('<img src=\"ajax/indicator_flower.gif\" />')
}catch(e){alert(e);}

var post = Form.serialize(form_id);
	
var opt = {
    // Use POST
    method: 'post',
    // Send this lovely data
    postBody:post ,
    // Handle successful response
    onSuccess: function(t) {
	//new Effect.Fade(update_div, { duration: 3.0 })
	Form.enable(form_id)
	// Dialog.setInfoMessage("Data Updated")
//alert("RESPONSE:"+t.responseText)
		showResponse(t.responseText, form_id,update_div, after_action, target)
    },
    // Handle 404
    on404: function(t) {
        alert('Error 404: location "' + t.statusText + '" was not found.');
    },
    // Handle other errors
    onFailure: function(t) {
	//Dialog.closeInfo()
	//Dialog.destroy()
	
	Element.update('debug',t.responseText)
       // alert('Error ' + t.status + ' -- ' + t.statusText);
    }
}

 //alert(opt.toString());
new Ajax.Request(url, opt);

	}
	
function showResponse(rText, form_id, update_div, after_action, target)
	{
		//alert(after_action);

if (after_action != ''){
//prompt('response',rText)
update_data_ajax(after_action, target, ''); //refresh data in a new function
}else{
	//alert(update_div+":"+rText)
try{$(target).update('');}catch(e){}
//alert($(update_div).innerHTML+":"+rText)

$(update_div).update(rText); //add returned data direct to the data div



}
}
var reloadI = 0

function reloadImages(target)
{
	//alert(document.getElementById('inpUploadedFile').value);
	if (reloadI == 0){
		reloadI = 1
	}else{
		document.location.href = "shopassetmanager.asp?id="+target+"&ifile="+document.getElementById('inpUploadedFile').value;  
		}
	
	}
function reloadNow(target){
		document.location.href = "shopassetmanager.asp?id="+target+"&ifile="+document.getElementById('inpUploadedFile').value; 
}
function request_photo_resize(idd,single,target){
	var pp = 'w='+idd;
	var url = "ResizeImage.aspx";
	//alert(idd)
	var post = pp;
	var opt = {
		// Use POST
		method: 'post',
		// Send this lovely data
		postBody:post ,
		// Handle successful response
		onSuccess: function(t) {
		//Element.update(target,t.responseText);
			if(single=="true"){
				reloadNow(target);
			}else{
				reloadImages(target);
			}
		},
		// Handle 404
		on404: function(t) {
			debug.innerHTML = ('Error 404: location "' + t.statusText + '" was not found.');
		},
		// Handle other errors
		onFailure: function(t) {
			debug.innerHTML = ('Error ' + t.status + ' -- ' + t.statusText + ' -- '+t.responseText);
		}
	}

 	//alert(opt.toString());
	new Ajax.Request(url, opt);
	}

function update_data_ajax (action, target, idd) {
//alert(action)
var pp = 'id='+idd;

	var url = "/ajax/ajax.asp?a="+action;
//alert(idd)
	//Element.update(target,'<img src=\"ajax/indicator_flower.gif\" />   Loading, Please Wait...       [ <a href=\"javascript:window.location.href = window.location.href;\">Reload This Page</a> ]');
	pp = pp.toQueryParams();
	//alert(pp.toString());
	var post = Object.toQueryString(pp);
//	alert(post)
var opt = {
    // Use POST
    method: 'post',
    // Send this lovely data
    postBody:post ,
    // Handle successful response
    onSuccess: function(t) {
	Element.update(target,t.responseText);
    },
    // Handle 404
    on404: function(t) {
        debug.innerHTML = ('Error 404: location "' + t.statusText + '" was not found.');
    },
    // Handle other errors
    onFailure: function(t) {
        debug.innerHTML = ('Error ' + t.status + ' -- ' + t.statusText + ' -- '+t.responseText);
    }
}

 //alert(opt.toString());
new Ajax.Request(url, opt);
	}

function getnav_ajax (action, idd) {
//alert(action)
var pp = 'id='+idd;
	var url = "/ajax/ajax.asp?a="+action;
	pp = pp.toQueryParams();
	var post = Object.toQueryString(pp);
var opt = {
    method: 'post',
    postBody:post ,
    onSuccess: function(t) {
	setMainNav(t.responseText, idd);
    },
    on404: function(t) {
        debug.innerHTML = ('Error 404: location "' + t.statusText + '" was not found.');
    },
    onFailure: function(t) {
        debug.innerHTML = ('Error ' + t.status + ' -- ' + t.statusText + ' -- '+t.responseText);
    }
}

 //alert(opt.toString());
new Ajax.Request(url, opt);
	}
//-->
