// this function is used to uncheck all the radio buttons of a particular id

//Start of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751
var printInStore = 'false';
//End of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751

function unCheckRadio(id){
        // variables to store 1)radio buttons count,2)array of radio buttons.
        var radioButtonsCnt = document.getElementsByName(id).length;
        var radioButtons = document.getElementsByName(id);
        if(radioButtonsCnt>0){
                for (var count = 0; count < radioButtonsCnt; count++) {
                        if(count!=1){
                                if (radioButtons[count].checked) {
                                //uncheck if button is already selected
                                        radioButtons[count].checked = false;
                                }
                        }else{
                                        radioButtons[count].checked = true;
                        }
                }
        }
}

//Start of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751
function setPrintInStoresVal(isPrintInStore)
{
	printInStore = isPrintInStore;
}
//End of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751

// this function is called by ajax function to display response
function displayPhotoCard(responseData){
        document.getElementById("podCenterContent").innerHTML=responseData;
        var something = document.getElementById("podCenterContent").title;
        document.getElementById("loadStatus").style.display="none";
        toggleCardPreviewDisplay();
		//	Start of Modification by Infosys for Print On Demand on  06/08/2007
		s_pageName=document.getElementById("temp_pageName").value;
		//s_channel=document.getElementById("temp_channel").value;
		
		s_hier1=document.getElementById("temp_hier1").value;
		s_prop1=document.getElementById("temp_prop1").value;
		s_prop2=document.getElementById("temp_prop2").value;
		s_prop3=document.getElementById("temp_prop3").value;
		s_prop5=document.getElementById("temp_prop5").value;
		s_prop12=document.getElementById("temp_prop12").value;
		s_prop23=document.getElementById("temp_prop23").value;
		s_prop24=document.getElementById("temp_prop24").value;
		s_eVar6=document.getElementById("temp_eVar6").value;
		s_eVar7=document.getElementById("temp_eVar7").value;
		s_eVar11=document.getElementById("temp_eVar11").value;
		s_prop17=document.getElementById("temp_prop17").value;
		s_eVar12=document.getElementById("temp_eVar12").value;
		s_prop18=document.getElementById("temp_prop18").value;
		s_prop30=document.getElementById("temp_prop30").value;
		s_prop31=document.getElementById("temp_prop31").value;
		s_prop32=document.getElementById("temp_prop32").value;
		s_events=document.getElementById("temp_events").value + ',event33';	
		
		//Start of Modification by Infosys for RT36787
		if( s_pageName == qspageName)
		{
			s_events += "," +qsEvent;
			s_prop35 = qsprop35;
			s_eVar45 = qsevar45;
		}
		//End of Modification by Infosys for RT36787
		if(s_pageName == "")
			{ s_eVar32 = window.location; }
		else
			{ s_eVar32 = s_pageName; };
		if (location.hostname == "")
		    { var temp = "local"; }
		else
		    { var temp = location.hostname; }
		s_channel = temp + " - " + s_prop1;
			
		sendAnalyticsEvent('');
	//	End of Modification by Infosys for Print On Demand on  06/08/2007        
}
//this function will get invoked from LeafPhotoCardCategoryContent while displaying ajax response
function callPagination(url){
        makeHttpRequest(url,'displayPhotoCard');
        toggleCardPreviewDisplay();
}
function callPhotoCardPreview(previewUrl, dkUrl){
// Start of Modification by Infosys for Print On Demand on  06/06/2007 
        makeHttpRequest(previewUrl,'displayPhotoCardPreview');
        document.getElementById('podCardPreview_FrontButton').href=dkUrl;
        document.getElementById('podCardPreview_InsideButton').href=dkUrl;
        document.getElementById('podCardPreview_BackButton').href=dkUrl;
// End of Modification by Infosys for Print On Demand on  06/06/2007		
}
function callView(url){
        makeHttpRequest(url,'displayPhotoCard');
        toggleCardPreviewDisplay();
}
function openDiv(divname) {
        var elemOpen = document.getElementById(divname);
        elemOpen.style.display = "block";
}
function closeDiv(divname) {
        var elemClose = document.getElementById(divname);
        elemClose.style.display = "none";
}
function toggleDisplay(id) {
        var elem = document.getElementById(id);
        if ((elem.style.display=="") || (elem.style.display=="inline")) {
                elem.style.display="none";
        } else if (elem.style.display=="none") {
                elem.style.display="inline";
        }
}
// This function will display blank card preview
function toggleCardPreviewDisplay()
{
	//Start of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751
	if(printInStore == 'true')
	{
		var alternateContent = '<a href="CategoryDisplay?storeId=10001&catalogId=10051&CatIDsList=193568&categoryId=193568"><img src="/wcsstore/HallmarkStore/images/products/podstore/step_1_blue.jpg" width="980" height="100" border="0"></a>';
		document.getElementById("storeBannerSwf").innerHTML=alternateContent;
	}
	else
	{
		document.getElementById("bannerImage").style.display="none";
		document.getElementById("PODRightNavBar").style.display="inline";
	}
	//End of Modification by Infosys for Print On Demand for CreateInStore-PrintInStore RT-31751        
    document.getElementById("podCenterContent").style.display="inline";
}
//Start Of modifications by Infosys for RT38711 - Ajax Call removal
function showDivTag(divTagId)
        {
                var divTag  = document.getElementById(divTagId);
                divTag.style.visibility = "visible";
        }
function hideDivTag(divTagId)
        {
                var divTag  = document.getElementById(divTagId);
                divTag.style.visibility = "hidden";
        }
function maskBackground()
{
	if(document.getElementById('popupContainer') && document.getElementById("pageMask")){
		document.body.style.overflow='hidden';
		getPageSize();
		document.getElementById("pageMask").style.height = "2500px";		
		document.getElementById("pageMask").style.width="2500px";		
		document.getElementById("pageMask").style.left="0px";
		document.getElementById("pageMask").style.top="0px";
		document.getElementById("pageMask").style.zIndex="200";
		document.getElementById("pageMask").style.opacity="0.75";
		document.getElementById("pageMask").style.display = "block" ;
	}
}
function hideMask()
{
	if(document.getElementById("pageMask")){
		document.body.style.overflow='auto';
		document.getElementById("pageMask").style.display = "none" ;
	}
}
function disableTitleBar()
{
	 document.getElementById("popupTitleBar").style.display="none";	
} 
function getPageSize()
 {
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}			
		
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
		document.getElementById("pageMask").style.height = (pageHeight - 130)+'px';
	}
	
	//Start of Modification by Infosys for RT37317 
function showPersonalize(url)
{
	document.location.href=url;
}
//End of Modification by Infosys for RT37317 
//End Of modifications by Infosys for RT38711 - Ajax Call removal
//Start of Modifications by Infosys for RT43681

var child_window_address=null;
var parent_window = null;
function openViewRecipients(pageType,OrderItemId,prodDesc,cardDesc,quantity,imageSrc,primeLineNo)
{
	popupwidth=450;
	popupheight=400;
	var winl = (screen.width - popupwidth) / 2;
	var wint = (screen.height - popupheight) / 2;
   
	winprops = "status="+0+",titlebar="+ 0+",scrollbars="+ 1+",height="+ popupheight+",width="+popupwidth+",top="+wint+",left="+winl+",modal=yes";

	//if (window.navigator.appVersion.indexOf("MSIE")!=-1)
	//{
		//window.showModalDialog('AddressView?pageType='+pageType+'&OrderItemId='+OrderItemId+'&prodDesc='+encodeURIComponent(prodDesc)+'&cardDesc='+encodeURIComponent(cardDesc)+'&quantity='+quantity+'&imageSrc='+imageSrc,window,'width:450px;dialogHeight:400px;');
	//}
	//else 
	//{
		var parent_window=window;	
		child_window_address = window.open('AddressView?pageType='+pageType+'&OrderItemId='+OrderItemId+'&prodDesc='+encodeURIComponent(prodDesc)+'&cardDesc='+encodeURIComponent(cardDesc)+'&quantity='+quantity+'&imageSrc='+imageSrc+'&primeLineNo='+primeLineNo,'AddressView',winprops);
		parent_window.onclick = childWindowFocus;
		parent_window.onfocus = childWindowFocus;
	//}	
}
function childWindowFocus()
{	
	if(child_window_address)
	{
		if(parent_window)
			parent_window.blur();
		if(!window.child_window_address.closed)
			child_window_address.focus();
	}
}
//End of Modifications by Infosys for RT43681
