function popup0(f,nom, w, h) {
	var top=0;
	var left=0;
	if (self.screen)
		left=(screen.width-(w+((screen.width*1)/100)));
	myWin = window.open(f, nom, 'resizable,screenX=0,screenY=0,scrollbars=yes,menubar=no,top='+top+',left='+left +',width=' + w + ',height=' + h );
	myWin.focus();
}

	var $loading = $('<img src="/img/shared/loading-bar.gif" alt="loading" class="loading">');
	function popup(url,divname, w, h) {
		
		var $dialog = $('<div></div>').append($loading.clone());
		$dialog
			.load(url + '#content')
			.dialog({
				title: divname,
				modal:true,
				width: w,
				height: h
			});
		$dialog.dialog('open');
		return false;
	}

	function DisplayMsg(myMsg, boxid, timeout)
	{
		myBox = $('#'+boxid);
		if (myMsg.length > 1)
		{
			// check in which element should we write the message
			if ($(myBox).children("p").length) {
				textin = $(myBox).children("p");
			}
			else { 
				textin = $(myBox); // if no <p> child, then write into the div box itself
			}
			textin.html(myMsg);
		}
		// show div
		$(myBox).show('blind',{},700,callback);
			
	//	callback function to bring a hidden box back
		function callback(){
			if (timeout > 1) {
				setTimeout(function(){
					$(myBox).hide(800).fadeOut(900);
				}, timeout);
			}
		};
		
		return false;
	}

	function clearMsg(boxid) {
		$('#'+boxid).hide();
	}

	function showInfo(mybox) {
		//get the position of the placeholder input
		var pos = mybox.offset();  
		var width = mybox.width();
		var tickbox = mybox.next("span.hint");
		tickbox.css( { "left": (pos.left + width + 2) + "px", "top":(pos.top - 9) + "px"} );
		tickbox.fadeIn(200);
		setTimeout(function(){
					tickbox.fadeOut(700);
				}, 5000);
	}
	function hideInfo(mybox) {
		mybox.next("span.hint").fadeOut(600);
	}
	function loadMobilePhoto(id, modelName, brandName, size)
	{
		$('#modelPicture').fadeTo("fast", 0.33);
		// Set image source
		if (id==0 && modelName=='' && brandName=='') {
			var src = "/img/shared/phone_nopict.jpg";
			$('#modelPicture').attr("src", src);
		}
		else {
			var src = "/picture+" + size + "+" + brandName + "+" + modelName + "+" + id + ".jpg";
			var title = brandName + " " + modelName;
			$('#modelPicture').attr("src", src);
			$('#modelPicture').attr("alt", title);
			$('#modelPicture').attr("title", title);
			$('#modelPicture').fadeTo("slow", 1);
		}
	}

