﻿function Popup(url, w, h)
{
    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;
    window.open(url, "popPrint", "dependent,modal,center=yes;resizable=yes,toolbar=no,scrollbars=yes,menubar=no,status=yes,directories=no,width=" + w + ",height=" + h + ",top=" + wtop + ",left=" + wleft);
}

var tags = new Array( 'span', 'div','td','tr','p','b','table','strong','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd');
var pixelArray =  new Array('9','11','13','15','24','30','40');
var emArray =  new Array('0.6','0.9','1.0','1.5','2.0','2.5','3');
var initSize = 1;
var incSize = 1;

function fontSizer(inc,unit) {
	
	if (!document.getElementById) 
		return;
			
    incSize += inc;    
    if (incSize <0)
        incSize=0;    
    
    inc = incSize;    
	var sizeTitle = 20;
	var size = initSize;
		size = inc;
		
		if (inc > 1)
			sizeTitle +=inc;
		
	if (size < 0 ) {
		size = 0;
        }
	        if (size > 6 ) {
		        size = 6;
        }
        initSize = size;
        getBody = document.getElementById('ResizeBody');				
	for (i = 0 ; i < tags.length ; i++ ) {
		getallTags = getBody.getElementsByTagName(tags[i]);
	for (k = 0 ; k < getallTags.length ; k++) 		
		{
		//if (getallTags[k].style.fontSize != undefined) alert(getallTags[k].style.fontSize)		
		
		if (getallTags[k].className == "tabTitle")		
			{
			getallTags[k].style.fontSize = sizeTitle+'px';						
			}
		else if (getallTags[k].tagName == "H1")		
			{
			getallTags[k].style.fontSize = sizeTitle+'px';						
			}			
		else
			getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;			
		}
	}
}

var lineH=1;
function LineHeightInc()
{
    lineH +=0.5;
    $('div#ResizeBody').css("lineHeight",lineH);
}

/*Rating*/
function Rate(callback, r, id)
{    
    callback.SendCallback(r+";"+id);
}

function ShowSelection(s, holderID) 
{    
    $("#" + holderID + " li").removeClass().addClass("rateStarNone");
    var sIndex = $("#" + holderID + " li").index(s);

    $("#" + holderID + " li").each(
        function(i) {
            if (i > sIndex)
                return;                
            $(this).removeClass().addClass("rateStarFull");
    });
}
function SetRate(r, holderID)
{    
    var rate = r;
    
    $("#" + holderID + " li").removeClass().addClass("rateStarNone");
    $("#" + holderID + " li").each(
        function(i) {
            if (Math.floor(rate) <= i)
                return;                
            $(this).removeClass().addClass("rateStarFull");
        });

    if (Math.abs(rate - Math.floor(rate)) >0.4) {
        var li = $("#" + holderID + " li").get(Math.floor(rate));
        $(li).removeClass().addClass("rateStarHalf");
    }
}

function ToggleSubmenu(id, show)
{
    if (show)
        $(id).addClass("menuSubBg");
    else
        $(id).removeClass("menuSubBg");
}