           
//jquery
$(document).ready(function() {
	  
	 	 
   $('.msg a.close').click(function(e) {
   e.preventDefault();
   $(this).parent('div.msg').fadeOut(500);
   });	 
	 
	 

   $('.hasTabs').tabs();	 	 
	 	function initTabs(){
  var tabIndex = {'Tvideos':1,'Tseries':4,'Tpk':4}
  var re = /#w+$/; // This will match the anchor tag in the URL i.e. http://here.com/page#anchor
  var match = re.exec(document.location.toString());
  if (match != null) var anchor = match[0].substr(1);
  for (key in tabIndex) {
    if (anchor == key) {
      selectedTab = tabIndex[key];
      break;
    }
    else selectedTab = 0;
  }
  tabs = $(".hasTabs").tabs({selected:selectedTab}); // render the tabs
        tabs.bind('tabsshow', function(event, ui) { // when tab is shown update the URL
        var re = /#w+$/;
        var url = document.location.toString();
        // to make bookmarkable
        document.location = url.replace(re, "#"+ui.panel.id);
        });
  }
  
   $('#trr-dialog,#tusoe-dialog').dialog({autoOpen:false,modal:true,width:400, title:'Please consider buying from us!', buttons: {
   
         "Close & buy from orchestrotica.com":
         function() { $(this).dialog("close"); }
    
} });
   
  $('a.closeDialog').click(function(e){
  e.preventDefault();
    $(".ui-dialog").hide("slow");
  
  });
  
  $('.trr a.itunes').click(function(e){
  e.preventDefault();
  console.log('trr');
   $('#trr-dialog').dialog('open');
  });
  $('.tusoe a.itunes').click(function(e){
  e.preventDefault();
  console.log('tusoe');
   $('#tusoe-dialog').dialog('open');
  });
  
  
  $('a[href=#Tseries], a[href=#Tpk]').click(function(e){
     e.preventDefault();
    $('.hasTabs').tabs({selected:4});
  });
  
  $('a[href=#TAudio],a[href=#Taudio],a[href=#Tvideos]').click(function(e){
    e.preventDefault();
    $('.hasTabs').tabs({selected:1});
  });
   
  
  
  
  
  
  
	 });
 
	//end jquery					  
						  
