
//////////////////////////////////////////////////////////////////////////////
// Flash Display Functions

function show_flash (file, w, h)
{
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + w + "' height='" + h + "' id='" + new Date() + "' align='middle'>");
	document.write ("<param name='allowScriptAccess' value='sameDomain' />");
	document.write ("<param name='movie' value='" + file + "' />");
	document.write ("<param name='quality' value='best' />");
	document.write ("<param name='wmode' value='transparent' />");
	document.write ("<param name='bgcolor' value='#ffffff' />");
	document.write ("<embed src='" + file + "' quality='best' wmode='transparent' bgcolor='#ffffff' width='" + w + "' height='" + h + "' name='gallery' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write ("</object>");
}

function make_flash (file, w, h)
{
	var html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + w + "' height='" + h + "' id='" + new Date() + "' align='middle'>";
	html = html + "<param name='allowScriptAccess' value='sameDomain' />";
	html = html + "<param name='movie' value='" + file + "' />";
	html = html + "<param name='quality' value='best' />";
	html = html + "<param name='wmode' value='transparent' />";
	html = html + "<param name='bgcolor' value='#ffffff' />";
	html = html + "<embed src='" + file + "' quality='best' wmode='transparent' bgcolor='#ffffff' width='" + w + "' height='" + h + "' name='gallery' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	html = html + "</object>";
	return html;
}

function show_flash_ssl (file, w, h)
{
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + w + "' height='" + h + "' id='" + new Date() + "' align='middle'>");
	document.write ("<param name='allowScriptAccess' value='sameDomain' />");
	document.write ("<param name='movie' value='" + file + "' />");
	document.write ("<param name='quality' value='best' />");
	document.write ("<param name='wmode' value='transparent' />");
	document.write ("<param name='bgcolor' value='#ffffff' />");
	document.write ("<embed src='" + file + "' quality='best' wmode='transparent' bgcolor='#ffffff' width='" + w + "' height='" + h + "' name='gallery' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write ("</object>");
}

function make_flash_ssl (file, w, h)
{
	var html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + w + "' height='" + h + "' id='" + new Date() + "' align='middle'>";
	html = html + "<param name='allowScriptAccess' value='sameDomain' />";
	html = html + "<param name='movie' value='" + file + "' />";
	html = html + "<param name='quality' value='best' />";
	html = html + "<param name='wmode' value='transparent' />";
	html = html + "<param name='bgcolor' value='#ffffff' />";
	html = html + "<embed src='" + file + "' quality='best' wmode='transparent' bgcolor='#ffffff' width='" + w + "' height='" + h + "' name='gallery' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	html = html + "</object>";
	return html;
}

//////////////////////////////////////////////////////////////////////////////
// Slate Click Event Handlers

function click_signout()
{
	var answ = confirm ("Are you sure you want to sign out?");
	if (answ)
	{
	    document.location.href="/Logout.aspx";
    }
}

function click_profile()
{
	document.location.href="/zone/profile.aspx";
}

function click_contact()
{
	document.location.href="/zone/contact.aspx";
}

function click_home()
{
	document.location.href="/zone/Default.aspx";
}

//////////////////////////////////////////////////////////////////////////////
// Page Display Functions

function show_headline (hdlText)
{
    if (hasProperFlashVersion)
    {
	    show_flash("/_gfx/hl.swf?headline=" + hdlText,132,30);
    }
    else
    {
	    document.write ("<div class='headline'>" + hdlText + "</div>");
    }
}

function show_headline_long (hdlText)
{
    if (hasProperFlashVersion)
    {
	    show_flash("/_gfx/hl_long.swf?headline=" + hdlText,575,30);
    }
    else
    {
	    document.write ("<div class='headline'>" + hdlText + "</div>");
    }
}

function show_videoPlayer (strPath, boolLoop)
{
    if (hasProperFlashVersion && strPath.length > 0)
    {
	    var html = "<div class='videoPlayer'>";
	    html += make_flash("/_gfx/videoPlayer.swf?v=" + strPath + "&l=" + boolLoop,300,300);
	    html += "</div>";
	    document.write(html);
    }
}

function show_random_headline()
{
	arr = new Array();
	arr[0] = "Welcome to Trend Offset Printing";
	arr[1] = "Trend can save you time and money";
	arr[2] = "Trend focuses on customer solutions";
	arr[3] = "Trend handles all of your print needs";
	arr[4] = "Trend makes service No. 1 priority";
	arr[5] = "Nationwide platform elevates Trend";

    var rand = Math.round(Math.random() * (arr.length - 1));
	hdlText = arr[rand];

    if (hasProperFlashVersion)
    {
	    show_flash("/_gfx/hl_long.swf?headline=" + hdlText,575,30);
    }
    else
    {
	    document.write ("<div class='headline'>" + hdlText + "</div>");
    }
}

function show_slideshow (imgDir, noFlashImage, host)
{
    if (hasProperFlashVersion)
    {
	    show_flash("/_gfx/slides.swf?d=" + imgDir + "&host=" + host,624,253);
    }
    else
    {
	    document.write ("<img src='" + noFlashImage + "' width='624' height='253'>");
    }
}

function show_nav (currentUrl)
{
    if (hasProperFlashVersion)
    {
		show_flash("/_gfx/nav_sub.swf?s=" + currentUrl,275,300);
	}
	else
	{
		document.getElementById("noFlashNav").style.visibility = "visible";
		document.getElementById("noFlashNav").style.position = "relative";
	}
}

function show_popup(URL)
{
    win = window.open(URL, 'popWin', 'toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,width=600,height=600,left=300,top=300');
    win.focus();
}

function issue_showalertform(pubID, issueID)
{
    var URL = "/zone/popups.aspx?cmd=showalertform&PubID=" + pubID + "&IssueID=" + issueID;
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,width=600,height=400,left=200,top=150');");
}

function issue_showscoreform(pubID, issueID)
{
    var URL = "/zone/popups.aspx?cmd=showscoreform&PubID=" + pubID + "&IssueID=" + issueID;
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=auto,location=0,status=0,menubar=0,resizable=0,width=865,height=700,left=200,top=150');");
}

function issue_showcarform(pubID, issueID)
{
    var URL = "/zone/popups.aspx?cmd=showcarform&PubID=" + pubID + "&IssueID=" + issueID;
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,width=600,height=400,left=200,top=150');");
}

function makeEmail(name, user, domain)
{
	document.write("<a href=" + "mail" + "to:" + user + "@" + domain + ">" + name + "</a>");
}


//////////////////////////////////////////////////////////////////////////////
// String Functions

function htmlEntities(texto){
    //by Micox - elmicoxcodes.blogspot.com - www.ievolutionweb.com
    var i,carac,letra,novo='';
    for(i=0;i<texto.length;i++){
        carac = texto[i].charCodeAt(0);
        if( (carac > 47 && carac < 58) || (carac > 62 && carac < 127) || carac == 32){
            //se for numero ou letra normal
            novo += texto[i];
        }else{
            novo += "&#" + texto[i].charCodeAt(0) + ";";
        }
    }
    return novo;
}

//////////////////////////////////////////////////////////////////////////////
// Page Load Functions

function page_init()
{
	// alert ("init");
}

