﻿var divthick;
var divthick2;
function MM_swapImgRestore(){var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;}
function MM_preloadImages() {var d = document; if (d.images) {if (!d.MM_p) d.MM_p = new Array();var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } }}
function MM_findObj(n, d) {var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);}if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);if (!x && d.getElementById) x = d.getElementById(n); return x;}
function MM_swapImage() {var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }}
function getids(val) {return document.getElementById(val);}
function createThickBox(sourceval, w, h) {if (!getids('divthickprofile')) {divthick = document.createElement('iframe');divthick.id = 'divthickprofile';divthick.frameborder = "0";divthick.border = "0";divthick.scrolling = "no";divthick.width = w;divthick.height = h;divthick.style.display = "none";document.body.appendChild(divthick);}else {divthick = getids('divthickprofile');divthick.src = "";divthick.frameborder = "0";divthick.border = "0";divthick.scrolling = "no";divthick.width = w;divthick.height = h;}getallDirections(divthick, w, h);divthick.style.width = w;divthick.style.height = 0;$(divthick).animate({ height: h + "px" }, 1000);divthick.className = "divthick";divthick.src = sourceval;getids('divMask').style.display = "block";getids('divMask').style.backgroundColor = colorConv("D9D9D9");colorFade('divMask', 'background', 'D9D9D9', '000000', 10, 10);}
function getallDirections(obj, OffsetWidth, OffsetHeight) {var width = pageWidth();var height = pageHeight();var left = leftPosition();var top = topPosition();var dialogwidth = OffsetWidth || obj.offsetWidth;var dialogheight = OffsetHeight || obj.offsetHeight;var topposition = top + (height / 2) - (dialogheight / 2);var leftposition = left + (width / 2) - (dialogwidth / 2);obj.style.top = Math.ceil(topposition) + "px";obj.style.left = Math.ceil(leftposition) + "px";}
function pageWidth() {return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;}
function pageHeight() {return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;}
function topPosition() {return 0;}//return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
function leftPosition() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;}
function thickRemove() {if (getids('divthickprofile')){ getids('divthickprofile').style.display = "none"; getids('divthickprofile').src = "Blank.aspx"; }if (getids('divmessage')){ getids('divmessage').style.display = "none"; }getids('divMask').style.display = "none";}
function colorFade(id, element, start, end, steps, speed) {var startrgb, endrgb, er, eg, eb, step, rint, gint, bint, step;var target = document.getElementById(id);steps = steps || 20;speed = speed || 20;clearInterval(target.timer);endrgb = colorConv(end);er = endrgb[0];eg = endrgb[1];eb = endrgb[2];if (!target.r) {startrgb = colorConv(start);r = startrgb[0];g = startrgb[1];b = startrgb[2];target.r = r;target.g = g;target.b = b;}rint = Math.round(Math.abs(target.r - er) / steps);gint = Math.round(Math.abs(target.g - eg) / steps);bint = Math.round(Math.abs(target.b - eb) / steps);if (rint == 0) { rint = 1 }if (gint == 0) { gint = 1 }if (bint == 0) { bint = 1 }target.step = 1;target.timer = setInterval(function() { animateColor(id, element, steps, er, eg, eb, rint, gint, bint) }, speed);}
function animateColor(id, element, steps, er, eg, eb, rint, gint, bint) {var target = document.getElementById(id);var color;if (target.step <= steps) {var r = target.r;var g = target.g;var b = target.b;if (r >= er) {r = r - rint;} else {r = parseInt(r) + parseInt(rint);}if (g >= eg) {g = g - gint;} else {g = parseInt(g) + parseInt(gint);}if (b >= eb) {b = b - bint;} else {b = parseInt(b) + parseInt(bint);}color = 'rgb(' + r + ',' + g + ',' + b + ')';if (element == 'background') {target.style.backgroundColor = color;} else if (element == 'border') {target.style.borderColor = color;} else {target.style.color = color;}target.r = r;target.g = g;target.b = b;target.step = target.step + 1;} else {clearInterval(target.timer);color = 'rgb(' + er + ',' + eg + ',' + eb + ')';if (element == 'background') {target.style.backgroundColor = color;} else if (element == 'border') {target.style.borderColor = color;} else {target.style.color = color;}}}
function colorConv(color) {var rgb = [parseInt(color.substring(0, 2), 16), parseInt(color.substring(2, 4), 16), parseInt(color.substring(4, 6), 16)];return rgb;}
function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps) {var steps = Math.ceil(fps * (time / 1000));var delta = (toOpacity - fromOpacity) / steps;FadeOpacityStep(elemId, 0, steps, fromOpacity, delta, (time / steps));}
function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep) {SetOpacity(document.getElementById(elemId), Math.round(parseInt(fromOpacity) + (delta * stepNum)));if (stepNum < steps)setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum + 1)+ ", " + steps + ", " + fromOpacity + ", "+ delta + ", " + timePerStep + ");",timePerStep);}
function SetOpacity(elem, opacityAsInt) {var opacityAsDecimal = opacityAsInt;if (opacityAsInt > 100)opacityAsInt = opacityAsDecimal = 100;else if (opacityAsInt < 0)opacityAsInt = opacityAsDecimal = 0;opacityAsDecimal /= 100;if (opacityAsInt < 1)opacityAsInt = 1;elem.style.opacity = opacityAsDecimal;elem.style.filter = "alpha(opacity=" + opacityAsInt + ")";}
function nextObject(obj) {var n = obj;do n = n.nextSibling;while (n && n.nodeType != '1');return n;}
function EmailValidation(str) {var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length; var ldot=str.indexOf(dot);if (str.indexOf(at)==-1){return false}if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false}if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false}if (str.indexOf(at,(lat+1))!=-1){return false}if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false}if (str.indexOf(dot,(lat+2))==-1){return false}if (str.indexOf(" ")!=-1){return false}return true}

function showSendLinkTable()
{
    var sendLinkTable = document.getElementById("sendLinkTable");
    if(sendLinkTable.style.display == 'block')
    {
        sendLinkTable.style.display = 'none';    
    }
    else
    {
        sendLinkTable.style.display = 'block';
    }
}

function SetSelectedLink(l, c) {
    l = getids(l);
    try{
        l.setAttribute("class", c);
    }
    catch(err){}
    l.setAttribute("className", c);
}
