<!--
	
var m
function openModal(l){
//alert("openmodal")
m = new Control.Modal($(l), {
		overlayOpacity: 0.80,
		fade: true
	});
m.open();
}

function closeModal(){

m.close();

}
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 openModalIframe(l){
m =  new Control.Modal($(l),{iframe: true,
			width: 700,
			height: 480});//{containerClassName: 'test',overlayClassName: 'test'});
m.open();
fixAbsentCursor();
return false;
}

function fixAbsentCursor() { $('modal_overlay').style.position = 'absolute'; }
//######################################################	
		
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;
	
	
	
//Element.update(target,'<img src=\"inc/indicator_flower.gif\" />')
//Element.update(target,'')
	//Form.disable(form_id);//disable form
	
//	openInfoDialog('Please wait updating ...')

	var post = Form.serialize(form_id)
	
	
	
	//alert(post)
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)
	{
//Dialog.closeInfo() //close dialog

//Dialog.destroy()

if (after_action != ''){
//prompt('response',rText)
update_data_ajax(after_action, target, ''); //refresh data in a new function
}else{
	//alert(update_div+":"+rText)
Element.update(update_div,rText); //add returned data direct to the data div
}
}

function update_data_ajax (action, target, idd) {

idd = idd.replace(/ /g, "%20");


var pp = 'id='+idd;

//var pp = encodeURIComponent('id='+idd);

	var url = "ajax/ajax.asp?a="+action;
//alert(url)
	//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> ]');
	
	Element.update(target,'');
	
	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);
    },
    // 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);
	}

//AJAX lightbox_text Start
var m = ""
var c = false
function mm(i){
//alert(i);
m = new Control.Modal(i,{beforeClose: function(){
if(!c)
{return false;}
}});
m.open();
//fixAbsentCursor();
return false;
}

function closeM(){
c = true;
m.close();
c = false;
}
   
//AJAX lightbox_text end