// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
Position.GetWindowSize = function(w) {
	var width, height;
        w = w ? w : window;
        this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
        this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
        
        return this;
}
Position.includeScrollOffsets = true;

function showAddItem(){
	$('add_item').show();
}
function uploadImg(target,input_field){
	var windowSize = Position.GetWindowSize();
	var mask = $('mask');
	mask.show();
	mask.style.width = windowSize.width + "px";
	mask.style.height = windowSize.height + "px";
	new Insertion.Bottom('mask','<div id="upload_panel" class="pop_panel"><iframe src="/uploader/upload" width="700px" height="150px" frameborder="0"></iframe></div>');
	var up = $('upload_panel')
	up.style.width = "350px";
	up.style.height = "100px";
	up.style.left = (windowSize.width/2-250) + "px";
	up.style.top = (windowSize.height/2-100) + "px";
}
function updateImgField(loc){
	$('product_img').src = loc+"_th.jpg"
	$('upload_panel').remove();
	$('mask').hide();
	$('product_image').value = loc
}
function closePanel(){
	$('upload_panel').remove();
	$('mask').hide();
	return false;
}