﻿// JScript File

// tinyMCE.init({
//    // General options
//    mode : "textareas",
//    theme : "advanced",
//    //plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

//    // Theme options
//    
////        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
////        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
////        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
////        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
//    
//    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
//    theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,help,code,|,forecolor",
//    theme_advanced_buttons3 : "hr,removeformat,|,charmap,emotions,advhr,|,visualchars,nonbreaking,pagebreak",
//    //theme_advanced_buttons4 : "",
//    
//    theme_advanced_toolbar_location : "top",
//    theme_advanced_toolbar_align : "left",
//    theme_advanced_statusbar_location : "bottom",
//    theme_advanced_resizing : true,

//    // Example content CSS (should be your site CSS)
//    content_css : "../css/Styles.css",

//    // Drop lists for link/image/media/template dialogs
//    template_external_list_url : "lists/template_list.js",
//    external_link_list_url : "lists/link_list.js",
//    external_image_list_url : "lists/image_list.js",
//    media_external_list_url : "lists/media_list.js",

//    // Replace values for the template plugin
//    template_replace_values : {
//    username : "Some User",
//    staffid : "991234"
//    }
//    });


var blocker = document.getElementById("blocker");
var arrDropDownVisibilityStatus = new Array();
function ShowBlocker()
{
    var intLoop;
    arrSelects = new Array();
    
    arrSelects = document.getElementsByTagName("SELECT");
    for (intLoop=0; intLoop < arrSelects.length; intLoop++)
    {
        arrDropDownVisibilityStatus[intLoop] = arrSelects[intLoop].style.visibility;
        arrSelects[intLoop].style.visibility = "hidden";
    }
    blocker.style.width = document.documentElement.clientWidth + "px";
    blocker.style.height = document.documentElement.scrollHeight + "px";
    blocker.style.display = "";
}

function HideBlocker()
{
    var intLoop;
    arrSelects = new Array();
    
    arrSelects = document.getElementsByTagName("SELECT");
    for (intLoop=0; intLoop < arrSelects.length; intLoop++)
    {
        arrSelects[intLoop].style.visibility = arrDropDownVisibilityStatus[intLoop];
    }
    blocker.style.display = "none";
}
function ShowEmailToAFriend(EmailToAFriendAddress,ProductId,ProductName,Image)
{ 
try
{
	//alert(ProductId);
	if(ProductId != null)
	{
		document.getElementById("ctl00_ContentPlaceHolder1_hdnProductIdForEmailToFriend").value = ProductId;
	}
	if(Image != null)
	{
		document.getElementById("ctl00_ContentPlaceHolder1_hdnImageForEmailToFriend").value = Image;
	}
	if(ProductName != null)
	{
	    document.getElementById("ctl00_ContentPlaceHolder1_hdnProductNameForEmailToFriend").value = ProductName;
		document.getElementById("ctl00_ContentPlaceHolder1_txtEmailSubject").value = "Ashley - " + ProductName.replace('_','"').replace('_','"');
	}
	var pnlSendEmail = document.getElementById("pnlSendEmail");

	ShowBlocker();
	pnlSendEmail.style.display = "none";
	var width =  700;
	var height =  550;
	
	document.getElementById("pnlSendEmail").style.top = ((screen.availHeight - height)/2 + getScrollTop() - 70) + "px";

	document.getElementById("pnlSendEmail").style.left = ((screen.availWidth - width)/2 + document.documentElement.scrollLeft) + "px";
	PopEx("pnlSendEmail", parseInt(document.getElementById("pnlSendEmail").style.left) + "A", parseInt(document.getElementById("pnlSendEmail").style.top) + "A", width, height, 50, "");				
}
catch(ex){}
return false;

}
function HideEmailToAFriend()
{
try
{
ResetFields();
var pnlSendEmail = document.getElementById("pnlSendEmail");                    
Revert(pnlSendEmail, 50, "");
setTimeout('document.getElementById("pnlSendEmail").style.display="none"', 200);
HideBlocker();
}
catch(ex){}  
return false;
} 
function ResetFields()
{
//document.getElementById('ctl00_ContentPlaceHolder1_txtFromAddress').value = '';
document.getElementById('ctl00_ContentPlaceHolder1_txtToAddress').value = '';
document.getElementById('ctl00_ContentPlaceHolder1_txtMailDesc').value = '';
document.getElementById('ctl00_ContentPlaceHolder1_lblMailErr').innerHTML = '';
return true;        
}
function getScrollTop()
{
var scrollTop;
if(document.body.scrollTop == 0)
{
    scrollTop=document.documentElement.scrollTop;
}
else
{
    scrollTop=document.body.scrollTop;
}
return scrollTop;
}


function setLoaderPosition()
{
    var width =  32;
	var height =  32;
	document.getElementById("divLoader").style.top = ((screen.availHeight - height - 50)/2 + getScrollTop() - 70) + "px";

	document.getElementById("divLoader").style.left = ((screen.availWidth - width + 70)/2 + document.documentElement.scrollLeft) + "px";
	
	if(screen.availHeight < 1000)
	{
	    document.getElementById("divLoader").style.top = ((screen.availHeight - height - 50)/2 + getScrollTop() - 20) + "px"; 
	}
	return true;
}
