	  function ppp (){
 
 // var divToPrint=document.getElementById('DivIdToPrint');
  var title = $("iframe").attr("id");
 //frames['2'].print();
//alert(frames['2'].name);
  if(frames['2'])
{
frames['2'].print();
}
else
{
frames['0'].print();
}
 //var rr="#"+title.contents();
 /*var titlee = $('#'+title).contents().find('#DivIdToPrint').html();
  
  var newWin=window.open('','Print-Window','width=1000,height=800');
  newWin.document.open();
  newWin.document.write('<html><link href="css/style_qrcode1.css"  rel="stylesheet" type="text/css" /><body onload="window.print()">'+titlee+'</body></html>');
  newWin.document.close();
  setTimeout(function(){newWin.close();},10000);*/
 
	}
 
 
var openDialog = null;
var openBigDialog = null;
var openGrandDialog = null;
var opengiberGrandDialog = null;
var openCustomDialog = null

// $(document).ready(function() {

	$.each($(".frame_dialog"), function(index, tab){
		$(tab).click(function(e){
			e.preventDefault();
			openDialog = $.FrameDialog
			.create({
				url: this.href,
				title: this.title,
				autoOpen: true,
				width: 750,
				minWidth: 750,
				height: 650,
				minHeight: 650,
				modal: true,
				draggable: true,
				buttons: {},
				resizable: true,
				open: function(event, ui){
					 $(this).parent().removeClass( 'custom_hgt' );	 
  				  
					}
			});
		});
	});

	$.each($(".frame_big_dialog"), function(index, tab){
		$(tab).click(function(e){
			e.preventDefault();
			openBigDialog = $.FrameDialog
			.create({
				url: this.href,
				title: this.title,
				autoOpen: true,
				width: 750,
				minWidth: 750,
				height: 750,
				minHeight: 750,
				modal: true,
				draggable: true,
				buttons: {},
				resizable: true,
				open: function(event, ui){
					 $(this).parent().removeClass( 'custom_hgt' );	 
  				  
					}
			});
		});
	});
	
	$.each($(".frame_grand_dialog"), function(index, tab){
		$(tab).click(function(e){
			e.preventDefault();
			openGrandDialog = $.FrameDialog
			.create({
				url: this.href,
				title: this.title,
				autoOpen: true,
				width: 980,
				minWidth: 980,
				height: 680,
				minHeight: 680,
				modal: true,
				draggable: true,
				buttons: {},
				resizable: true,
				open: function(event, ui){
					 $(this).parent().removeClass( 'custom_hgt' );	 
  				  
					}
			});
		});
	});

	$.each($(".frame_custom_dialog"), function(index, tab){
		$(tab).click(function(e){
			e.preventDefault();
			openCustomDialog = $.FrameDialog
			.create({
				url: this.href,
				title: this.title,
				autoOpen: true,
				width: $(this).attr('framewidth'),
				minWidth: $(this).attr('framewidth'),
				height: $(this).attr('frameheight'),
				minHeight: $(this).attr('frameheight'),
				modal: true,
				draggable: true,
				buttons: {},
				resizable: true,
				open: function(event, ui){
					 $(this).parent().removeClass( 'custom_hgt' );	 
  				  
					}
			});
		});
	});
	
 
 	
	$.each($(".frame_bigest_grand"), function(index, tab){
		$(tab).click(function(e){
			e.preventDefault();
			
			var classname = 'bigest_grand';
			var urlv = $(this).attr('href');
			if(urlv.indexOf('view_qrcode.php') > -1) {
				classname = 'qrcode_downloader';
			}
 			opengiberGrandDialog = $.FrameDialog
			.create({
				url: this.href,
				title: this.title,
				autoOpen: true,
				width: 995,
				minWidth: 995,
				height: 770,
				minHeight: 770,
				modal: true,
				draggable: true,
				buttons: {},
				resizable: true,
				dialogClass: classname,
				open: function(event, ui){
				
					/*
				var myurl = document.location.href;
				var pos = myurl.lastIndexOf("/");
				if(pos > -1) myurl = myurl.substring(0, pos);

				$(this).parent().find('.ui-dialog-titlebar').append('<span style="cursor: pointer;float: right; margin-right: 8%;"><img src="images/download.png" style="vertical-align: middle;"><span class="qr_code" id="download_btn" style=" font-size: 13px!important;padding: 7px 26px!important;"><a href="http://impdf.com?url='+myurl+'/view_qrcode1.php?id='+id_user+'&--orientation=Landscape&--margin-left=15mm">Download</a></span></span>');
				
				//print button code
				<img src="images/printer.png" style="margin-left:15px;vertical-align: middle;"><span id="print_btn" onclick="javascript:ppp();" class="qr_code"  style=" font-size: 13px!important;padding: 7px 26px!important;">Print</span>
				
				
                $(this).parent().find('.ui-dialog-titlebar').append('<span style="cursor: pointer;float: right; margin-right: 8%;"><img src="images/download.png" style="vertical-align: middle;"><span class="qr_code" id="download_btn" style=" font-size: 13px!important;padding: 7px 26px!important;"><a href="http://www.web2pdfconvert.com/engine?curl=http://www.biznessapps.com/client/view_qrcode.php?id='+id_user+'&outputmode=service&outputformat=pdf">Download</a></span><img src="images/printer.png" style="margin-left:15px;vertical-align: middle;"><span id="print_btn" onclick="javascript:ppp();" class="qr_code"  style=" font-size: 13px!important;padding: 7px 26px!important;">Print</span></span>');
				
			
				
				//http://impdf.com?url=http://www.biznessapps.com/partner2/view_qrcode.php?id=109&--margin-left=4mm
				//this defined in the buildwiz.css
			  $(this).parent().addClass( 'custom_hgt' );	 
				 */
			 
 				  
}
			});
		});
	});
	 

	$(".image_deletor").click(function(e){
		e.preventDefault();
		var url = $(this).attr("href");
		alert(url);
		$.get(url, function(data) {
			if(data == "okay") {
				if(typeof reloadCurrentTab == 'function') { 
					reloadCurrentTab(); 
				}
			} else {
				alert("Something has gone wrong....");
			}
		});
	});
	
// });
       
	
	
	

	var openDialog = null;
	function ParentOpenDialog(url, tab_title) {
	  openDialog = $.FrameDialog
	          .create({
	              url: url,
	              title: tab_title,
	              autoOpen: true,
	              width: 600,
	              minWidth: 600,
	              height: 350,
	              minHeight: 350,
	              modal: true,
	              draggable: true,
	              buttons: {},
	              resizable: true
	          }).bind("dialogclose", function(event, ui){
	            openDialog = null;
	          });
	}

	var openMainDialog = null;
	function ParentOpenMainDialog(url, tab_title) {
	  openMainDialog = $.FrameDialog
	          .create({
	              url: url,
	              title: tab_title,
	              autoOpen: true,
	              width: 800,
	              minWidth: 800,
	              height: 500,
	              minHeight: 500,
	              modal: true,
	              draggable: true,
	              buttons: {},
	              resizable: true
	          }).bind("dialogclose", function(event, ui){
	            openMainDialog = null;
	          });
	}

	var openCustomSizedDialog = null;
	function ParentOpenCustomSizedDialog(url, tab_title, widthv, heightv) {
		openCustomSizedDialog = $.FrameDialog
	          .create({
	              url: url,
	              title: tab_title,
	              autoOpen: true,
	              minWidth: widthv,
	              width: widthv,
	              minHeight: heightv,
	              height: heightv,
	              modal: true,
	              draggable: true,
	              buttons: {},
	              resizable: true
	          }).bind("dialogclose", function(event, ui){
	        	  openCustomSizedDialog = null;
	          });
	}

	var openSubDialog = null;
	function ParentOpenSubDialog(url, tab_title) {
	  openSubDialog = $.FrameDialog
	          .create({
	              url: url,
	              title: tab_title,
	              autoOpen: true,
	              width: 800,
	              minWidth: 800,
	              height: 600,
	              minHeight: 600,
	              modal: true,
	              draggable: true,
	              buttons: {},
	              resizable: true
	          }).bind("dialogclose", function(event, ui){
	            openSubDialog = null;
	          });
	}
