
//Global variables 

var myDialog=null;
var content="";
var choices="";

//Initialize the dialog widget that will display the pop-up dialog message
function initDialog(){   
	myDialog=new widgets.dialog({id:'bogoDialogId',className:'bogoDialogClass',backingClass:'bogoBackgroundClass'},true,true);
}  

// Function to hide the dialog widget when invoked
function hideDialog(){
	myDialog.hide(); 
}    

//Function to display the dialog pop up 
function showDialog(this_event,target_obj){
    if(!myDialog){
        initDialog()
    }
	var cartItemIdHref = target_obj.href;
	if(nxVars.lang=='en'){
		content="<p class='textStyle'>The price will now change.</p><p class='textStyle'>Do you still wish to delete the selected phone? </p><p class='textStyle'></p>";
		choices ="<a href='"+ cartItemIdHref +"'><img src='/assets/images/common/buttons/bt_yl_yes_v1_en.jpg' alt='Yes Btn' width='63' height='23' class='space' /></a><a href='javascript:hideDialog();'><img src='/assets/images/common/buttons/bt_gy_no_v1_en.jpg' alt='No btn' width='63' height='23' /></a>";

	}
	else{
		content ="<p class='textStyle'>El precio cambiará ahora</p><p class='textStyle'>Todavía desea borrar el teléfono seleccionado?</p><p class='textStyle'></p>";
		choices ="<a href='"+ cartItemIdHref +"'><img src='/assets/images/common/buttons/bt_yl_yes_v1_es.jpg' alt='Yes Btn' width='63' height='23' class='space' /></a><a href='javascript:hideDialog();'><img src='/assets/images/common/buttons/bt_gy_no_v1_en.jpg' alt='No btn' width='63' height='23' /></a>";
	}
		var template = "<div class='podShell'><div class='topPod'><a href='javascript:hideDialog();'><img src='/assets/images/common/bubble_close.gif' alt='close' width='28' height='27' align='right'></a></div><div class='podRepeat'>" + content + "<div class='btns'>" + choices + "</div></div><div class='podBtm'></div></div>";	
	myDialog.setContent(template);  
	myDialog.center();    
	myDialog.show(); 
} 

var beh=new Behavior({
	css:'a.trash',
	events:{'trashClick':[false,true,true]}
});

Events.add('trashClick','click',showDialog);
Behaviors.addToDOMLoad(beh);
