var showAcc="";

jQuery(document).ready(function(){	
	loadShirtCategory();
	
	if ($("#video_link_dialog").size() > 0) { 	
		$("#video_link_dialog").dialog({
			resizable: false,
			autoOpen: false,
			modal: true,
			width: 564,
			height: 381
		});
	}
		
});

function showTab(id,tab){
    hideDivs();
    hideChilds();
    if(tab!=""&&tab!=undefined){
        jQuery("#div"+tab).find("img").each(function(){
            if(jQuery(this).attr("src")==url+'/images/ltz.gif'){
                jQuery(this).attr("src",jQuery(this).attr("src2"));                
            }
        });
        loadShirtCategory(id);
        //console.log(tab);
        jQuery(".tab").each(function(){
            jQuery(this).removeClass("tab_selected");
        });
        jQuery("#tab"+tab).addClass("tab_selected");
        jQuery("#div"+tab).show(0);
    }
}

function get(){
    var selected="";
    var dat=new Array();
    var str=new String(window.location.href);
    dat=str.split("#");
    if(dat.length>1){
        var strN=dat[dat.length-1];
        if(strN.indexOf("=")!=-1){
            var d=strN.split("=");
            showAcc=d[1];
            return "accesories";
        }else{
            return (dat[dat.length-1]?dat[dat.length-1]:tf);
        }
        
    }else{
        return tf;
    }
    
}

function hideDivs(){
    showAcc="";
    jQuery(".divimgs").each(function(){
        jQuery(this).hide(0);
    });
}

function hideChilds(){
    showAcc="";
    jQuery("#divaccesories").hide(0);
    jQuery(".childsacc").each(function(){
        jQuery(this).hide(0);
    });
}

function showChild(child){
    hideDivs();
    hideChilds();
    if(child!=""&&child!=undefined){
        jQuery("#child"+child).show(0);
    }
}

function loadShirtCategory(cat) {
	var rooturl = "http://www.teezeria.com/";
	jQuery.ajax({ 
		type: "POST",
		url: rooturl+"ajax/load_shirts.php",
		dateType:"html",
		data: ({
	    	category:cat
	    }),
	    success:function(html){
	    	$("#maintshirtdiv").html(html);	  
	    	$("#maintshirtdiv").show();
	    	$("#page_link_1").css("font-weight","bold"); 
	    }
 	});	
}

function showPage(page) {
	scroll(0,132);
	$(".page_container_div").hide();
	$("#div_img_"+page).show();
	$(".page_link").css("font-weight","normal");
	$("#page_link_"+page).css("font-weight","bold");	
}

function loadVideo() {
	$("#video_link_selection").html('<iframe width="560" height="349" src="http://www.youtube.com/embed/ul30EVnwJu4" frameborder="0" allowfullscreen></iframe>');
	$("#video_link_dialog").dialog("option","position","center");	
	$("#video_link_dialog").dialog("open");
}
