﻿//About Tell A friend
function Tell_Client(oSrc, args)
{
    $(".vali").css("color","#000000");
    $("input[@type!=image]").attr("style","");
    var temp;
    var a = 0;
    var ErrMsg;
    $("textarea").attr("style","");
    for (var i = 0; i < Page_Validators.length; i++)
    {
        if (Page_Validators[i].controltovalidate != undefined)
        {
            temp = Page_Validators[i].controltovalidate;
            temp = temp.replace("ctl00_ContentPlaceHolder1_","f");
             if(!Page_Validators[i].isvalid)
             {
                 $("#"+temp).css("color","#C82D4B");
                 ErrMsg = Page_Validators[i].errormessage;
                 $("#"+Page_Validators[i].controltovalidate).attr("style","border-color:#C82D4B");
                 a++;
             }
        }
        if(a>1)
        {
            $("#Err_Msg").html("Please fill out all required fields.");
        }
        else
        {
            $("#Err_Msg").html(ErrMsg);
        }
    }
}
$(function(){
var tempalteID = 0;
var width = 690;
var height = 470;
var left;
var top;
var midtop;
var midleft;
var winheight;
var winwidth;
var isOpen = false;
$(".list > img").css("cursor","pointer");
    $(".list > img").click(function(){
        $(".pop_box").animate({"opacity":0},1);
        left = parseInt(Math.ceil($("body").width())/2-(parseInt(width)/2))
		top = parseInt(($.pageHeight() - height)/2) + $(document).scrollTop();
		winheight = parseInt($(document).height());
		midleft = parseInt(document.body.clientWidth)/2;
		midtop = parseInt($.pageHeight()/2) + $(document).scrollTop();
		winwidth = parseInt($("body").width());
        if($(this).attr("alt") == "SOCIAL BUTTERFLY")
        {
            $(".pop_email").hide();
            $(".pop_email").eq(0).show();
        }
        else if($(this).attr("alt") == "MODERN WOMAN")
        {
            $(".pop_email").hide();
            $(".pop_email").eq(1).show();
        }
        else if($(this).attr("alt") == "WEDDING BELLE")
        {
            $(".pop_email").hide();
            $(".pop_email").eq(2).show();
        }
	    $(".pop_box").attr("style","height:"+winheight+"px;width:"+winwidth+"px");
	    $(".pop_box").animate({"opacity":0.5},500);
	    $(".pop_cont").attr("style","top:"+midtop+"px;width:1px;height:1px;left:"+midleft+"px");
	    $(".pop_cont").animate({"width":width,"left":left,"top":top,"height":height,"opacity":1},500);
	    isOpen  = true;
    })
    $("#closed").css("cursor","pointer");
    $("#closed").click(function(){
		$(".pop_box").animate({"opacity":0},500);
		$(".pop_cont").animate({"width":0,"left":midleft,"top":midtop,"height":0,"opacity":0},500,function(){
			$(".pop_box").hide();
			$(".pop_cont").hide();
		});	
		isOpen = false;
	})
	
	$(window).resize(function(){
	if(isOpen)
	{
	     var winheight = parseInt($(document).height());
         var winwidth = parseInt($("body").width());
         $(".pop_box").attr("style","top:0px;width:"+winwidth+"px;height:"+winheight+"px;left:0px;opacity:0.5;display:block;filter:alpha(opacity=50);");
	     top = parseInt(($.pageHeight() - height)/2) + $(document).scrollTop();
         left = parseInt(Math.ceil($("body").width())/2-(parseInt(width)/2));
	     $(".pop_cont").attr("style","top:"+top+"px;width:"+width+"px;height:"+height+"px;left:"+left+"px;opacity:1;display:block;filter:alpha(opacity=100);");
	}
	});
	
	$(window).scroll(function(){
	    $(window).resize();
	});
	
})

$.pageWidth = function()
{
    return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
}

$.pageHeight = function()
{
    return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
}
