// JScript File
<!-- 

var _oldColor;
var _oldClass;


    // FUNCTION TO GET THE VARIABLES FOR THE MYSMARTSEARCH SEARCH AND FORWARD IT TO THE COMPARE/FIND.ASPX FILE LOCATED AT THE
    // DOCUMENT'S RELATIVE DIRECTORY
    function mySmartSearchAction()
    {
        var catID = document.getElementById("ctl00_cphMainContent_CatDDL");
        var keyword = document.getElementById("ctl00_cphMainContent_mSK");
        var path = window.location.pathname;
        var page = sPath.substring(sPath.lastIndexOf('/') + 1);
        if(keyword.value == ""){
            keyword.value = "Please enter a product name.";
        }else{
            var url=window.location.href.replace(page, '');
            window.location=url + "compare/find.aspx?k=" + keyword.value + "&cat=" + catID.value;
        }
    }
    // END FUNCTION TO GET THE VARIABLES FOR THE MYSMARTSEARCH


function SetNewColor(source,newColor){
    _oldColor = source.style.borderColor;
    source.style.borderColor = newColor; 
}

function SetOldColor(source){   
    source.style.borderColor = _oldColor;  
}


var myWidth = 0, myHeight = 0;
var scrOfX = 0, scrOfY = 0;
function FindSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
}

function getScrollXY() {
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
}

function notifyUpdateSuccess(id){ 
    try
    {   
        getScrollXY();
        FindSize();
        var opacity = 0;   
        var objOverlay = document.getElementById(id);
        objOverlay.style.visibility = "visible";

        objOverlay.style.opacity = opacity; 
        objOverlay.style.MozOpacity = (.0 + opacity); 
        objOverlay.style.KhtmlOpacity = (.0 + opacity); 
        objOverlay.style.filter = "alpha(opacity=" + opacity + ")"; 
        
        objOverlay.style.top = parseInt(scrOfY) + (parseInt(myHeight) -  parseInt(objOverlay.style.height))/2 + "px"
        objOverlay.style.left = parseInt(scrOfX) + (parseInt(992) -  parseInt(objOverlay.style.width))/2 + "px"
        shiftOpacity(id,1200); 

    }
    catch(e)
    {
        //alert(e);
    }        
}    
   
function opacityfunc(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacityfunc(id, 0, 85, millisec);
    } 
    else { 
        opacityfunc(id, 85, 0, millisec); 
    } 
} 



    function ChangePassword(){
        
        var ctl00_cphMain_ChangePassword1 = document.getElementById("ctl00_cphMain_ChangePassword1");
        try
        {
            if (ctl00_cphMain_ChangePassword1)
                ctl00_cphMain_ChangePassword1.style.visibility = (ctl00_cphMain_ChangePassword1.style.visibility == "visible")? "hidden":"visible"; 
        }
        catch (x)
        {
            alert(x);
        }
        
        return false;
    }

   function smsValidateParams(TrueOrFalse){
        var bCheckBox = TrueOrFalse
        
        //get check box opt in / opt out selection
        var ctl00_cphMain_SMSGiftSelect = document.all ? document.all["ctl00_cphMain_SMSGiftSelect"] : document.getElementById("ctl00_cphMain_SMSGiftSelect");        
        if(ctl00_cphMain_SMSGiftSelect.checked){
            //first, check drop down list selection         
            var ctl00_cphMain_ddlProvider = document.all ? document.all["ctl00_cphMain_ddlProvider"] : document.getElementById("ctl00_cphMain_ddlProvider");
            if (ctl00_cphMain_ddlProvider.value.length < 1 ){
                throwErrorMessage("Please select your wireless service provider");
                return false;
            }
            // check phone number validity
            var ctl00_cphMain_txtCellNum = document.all ? document.all["ctl00_cphMain_txtCellNum"] : document.getElementById("ctl00_cphMain_txtCellNum");
            if(ctl00_cphMain_txtCellNum.value.length > 0 ){
                if (!/^([(]?\d{3}[-. )]?\d{3}[-. ]?\d{4})*$/.test(ctl00_cphMain_txtCellNum.value)){ ///\d{3}[-. ]?\d{3}[-. ]?\d{4}/
                    throwErrorMessage("Invalid cellular phone number");
                    return false;
                }
            }
            else{
                throwErrorMessage("Please enter Your cellular phone number");
                return false;
            }    
        }
        else
        {                
                return true;
        }
        /*
                //check box validation
        var bCheckBox = '<%=bChedkBoxIsValid %>'
        if(bCheckBox){
            if(!ctl00_cphMain_SMSGiftSelect.checked){
                throwErrorMessage("Please check the box above");
                return false;
            }
        }

        */
    }
    
    function throwErrorMessage(message){
        var ctl00_cphMain_LabelErrorMessage = document.all ? document.all["ctl00_cphMain_LabelErrorMessage"] : document.getElementById("ctl00_cphMain_LabelErrorMessage");    
        ctl00_cphMain_LabelErrorMessage.innerHTML = message;
    }


function CheckAllGifts(value){

    var checkboxs = document.aspnetForm.getElementsByTagName('input');      
    for(var i = 0, inp; inp = checkboxs[i]; i++) {
        if(inp.type.toLowerCase() == 'checkbox' && inp.id.indexOf("CheckGift") != -1) inp.checked = value;
    }                
   //document.getElementById("DLGifts$ctl01$CheckGift").checked = value;
}

function ClearText(id){
   document.getElementById(id).value = "";
}

function popUp(strURL,strType,strHeight,strWidth) {
    var strOptions="";
    if (strType=="console") strOptions="resizable,height="+ screen.availHeight  +",width="+ screen.availWidth ;//strOptions="resizable,height="+strHeight+",width="+strWidth;
    if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
    if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+ screen.availHeight  +",width="+ screen.availWidth;
    var newWin =    window.open(strURL, 'newWin', strOptions);
    if (newWin==null || typeof(newWin)=='undefined'){ if(confirm('Please allow Pop-ups from MyRegistry.com!\nWould you like to see instructions for how to allow Pop-ups from MyRegistry.com?')){location.href="../Forms/PopUpBlockerIE.aspx";} }
}

function right(e) {
var msg = "Sorry, you don't have permission to right-click.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function DisableRClick() 
{
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }


function MM_findObj(n, d) { //v4.01
  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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function PrintFrame(ofra){
    ofra.focus();
    ofra.print();
}




function popupWindow(){
window.open('freegifts.aspx', '','toolbar=none,status=1,width=505,height=570');
}


function ShowTermsPanel(id){
    var panel = document.getElementById(id);
    panel.style.visibility = "visible";
    var movie = document.getElementById("movie")
    movie.style.visibility = "hidden"
    //get client resulotion
    if ((screen.width == 800) && (screen.height == 600)){
    panel.style.left = "200px"
    panel.style.top = "20px"
    }    
    else if ((screen.width == 1024) && (screen.height == 768)){    
    panel.style.left = "240px"
    panel.style.top = "30px"
    }
    else if( (screen.width == 1280) && (screen.height)){
    panel.style.left = "350px"
    panel.style.top = "30px"    
    }
    
}

function HideTermsPanel(id){
    var panel = eval(document.getElementById(id));
    panel.style.visibility = "hidden";
    var movie = document.getElementById("movie")
    movie.style.visibility = "visible"
}

function ShowUpMsg(){
    var obj = document.getElementById('SuccessMessage')
    obj.style.visibility = "visible";
}

function popupWnd(wnd){
window.open(wnd, '','toolbar=none,status=1,scroll=yes,width=505,height=570');
}

// start datepicker


// Title: Timestamp picker
// Description: See the demo at url
// URL: http://us.geocities.com/tspicker/
// Script featured on: http://javascriptkit.com/script/script2/timestamp.shtml
// Version: 1.0
// Date: 12-05-2001 (mm-dd-yyyy)
// Author: Denis Gritcyuk <denis@softcomplex.com>; <tspicker@yahoo.com>
// Notes: Permission given to use this script in any kind of applications if
//    header lines are left unchanged. Feel free to contact the author
//    for feature requests and/or donations

function show_calendar(str_target, str_datetime) {
	
	//str_target="document.getElementById('" + str_target + "')"
	var arr_months = ["January", "February", "March", "April", "May", "June",
		"July", "August", "September", "October", "November", "December"];
	var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)

	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
	var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>Calendar</title>\n"+
		"</head>\n"+
		"<body bgcolor=\"White\">\n"+
		"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#4682B4\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar('"+
		str_target+"', '"+ dt2dtstr(dt_prev_month)+"'+document.cal.time.value);\">"+
		"<img src=\"../JS/prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"previous month\"></a></td>\n"+
		"	<td bgcolor=\"#4682B4\" colspan=\"5\">"+
		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
		"	<td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
		+str_target+"', '"+dt2dtstr(dt_next_month)+"'+document.cal.time.value);\">"+
		"<img src=\"../JS/next.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"next month\"></a></td>\n</tr>\n"
	);

	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#87CEFA\">"+
		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+
		week_days[(n_weekstart+n)%7]+"</font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#DBEAF5\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'; window.close();\">"+
					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'; window.close();\">"+
					"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
		"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
		"<input type=\"hidden\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
		"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	var vWinCal = window.open("", "Calendar", 
		"width=200,height=200,status=no,resizable=yes,top=200,left=200");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
	
	//alert(str_datetime.length)
	if (str_datetime.length <11)
	{
	    str_datetime= str_datetime + " 12:00:00"
	}
	var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
	if (!re_date.exec(str_datetime))
		return alert("Invalid Datetime format: "+ str_datetime);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
	return (new String (
			dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
	return (new String (
			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}

//end datepicker
/*
          var NN4        = (document.layers);

        if(NN4){
            document.captureEvents(Event.MOUSEMOVE|Event.MOUSEOUT|Event.MOUSEOVER);
    	}
    	document.onmousemove=handleEvent;
    	document.onmouseover=handleEvent;
    	document.onmouseout=handleEvent;
    
    	function handleEvent(evnt){
        
             window.status='MyRegistry.com'; return true;
        }
        
   */     
	
// End -->
function getCenter(id, xdiv,ydiv,scrollpos)
{

   var winW = 630, winH = 460;
   
    winH  = window.innerHeight
    winW  = window.innerWidth
   
    if(!winH){
    winW = document.body.clientHeight
    }

    if(!winH){
    winW = document.documentElement.clientHeight
    }

    if(!winH){
    winW = 460
    }
    
   
   if(!winW){
    winW = document.body.clientWidth
    }

    if(!winW){
    winW = document.documentElement.clientWidth
    }

    if(!winW){
    winW = 630
    }
    

    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
        winW = window.innerWidth;
        winH = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
        winW = document.documentElement.clientWidth;
        winH = document.documentElement.clientHeight;
      
        }
     }
     
       var x  = document.getElementById(id).offsetWidth
       var y = document.getElementById(id).offsetHeight
              
       if (scrollpos){
       
       winH = winH + getScrollingPosition()
       }
       
       document.getElementById(id).style.position = 'absolute'
       document.getElementById(id).style.top = winH/2  + 'px'
       document.getElementById(id).style.left = winW / 2 + 'px'
       
       if (xdiv){
        document.getElementById(id).style.marginLeft = - (xdiv /2) + 'px'
       document.getElementById(id).style.marginTop =  - (ydiv/2) + 'px'
       
       }
       else{
       document.getElementById(id).style.marginLeft = - (x /2) + 'px'
       document.getElementById(id).style.marginTop =  - (y/2) + 'px'
     }
     
}

function getScrollingPosition()
{
var position ;
if (typeof window.pageYOffset != 'undefined')
{
position = window.pageYOffset

}
else if (typeof document.documentElement.scrollTop
!= 'undefined' && document.documentElement.scrollTop > 0)
{
position = document.documentElement.scrollTop

}
else if (typeof document.body.scrollTop != 'undefined')
{
position =
document.body.scrollTop;
}
return position;
}