//====================================================================================================
//	Function Name	:	popupWindowURL
//	Purpose			:	Whenever you wanna open a link into a new window just call this function
//						you need to pass some arguemnts as described below.
//	Parameters		:	url  =	url to be open in the new window
//								winname = winname is the window name for the reference of that window
//								w is the width
//								h is the height
//								menu is the parameter, if you want menubar to be enabled on the window
//								resize if you wanna resize the window
//								scroll i fyou needed
//	Return			:	true or false
//----------------------------------------------------------------------------------------------------
function popupWindowURL(url, winname, w, h, menu, resize, scroll)
{
    var x = (screen.width-w)/2;
    var y = (screen.height-h)/3;

	if(winname == null)
		winname = "newWindow";
	
	if(w == null)
		w = 800;
	
	if(h == null)
		h = 600;
	
	if(resize == null)
		resize = 1;

	menutype   = "nomenubar";
	resizetype = "noresizable";
	scrolltype = "noscrollbars";
	
	if(menu)
		menutype = "menubar";
	
	if(resize)
		resizetype = "resizable";
	
	if(scroll)
		scrolltype = "scrollbars";
	
    cwin = window.open(url,winname,"top=" + y + ",left=" + x + ",screenX=" + x + ",screenY=" + y + "," + "status," + menutype + "," + scrolltype + "," + resizetype + ",width=" + w + ",height=" + h);

	if(!cwin.opener)
		cwin.opener = self;
	
	cwin.focus();

	return true;
}

//====================================================================================================
//	Function Name	:	CheckUncheck_Click
//----------------------------------------------------------------------------------------------------
function CheckUncheck_Click(fld, status)
{
	if(fld)
	{
		if(fld.length)
			for(i = 0; i < fld.length; i++)
				fld[i].checked = status;
		else
			fld.checked = status;
	}
}

//====================================================================================================
//	Function Name	:	Block_ShowHide
//----------------------------------------------------------------------------------------------------
function HomeBlock_ShowHide(id)
{
	if(id == 3)
	{
		document.getElementById("introSection3").style.visibility	= 'visible';
		document.getElementById("introSection3").style.display		= 'block';
		document.getElementById("introSection2").style.visibility 	= 'hidden';
		document.getElementById("introSection2").style.display 	= 'none';
		document.getElementById("introSection1").style.visibility 	= 'hidden';
		document.getElementById("introSection1").style.display 	= 'none';
		document.getElementById("introHead3").className = "tabHeadBgHover";
		document.getElementById("introHead2").className = "tabHeadBg";
		document.getElementById("introHead1").className = "tabHeadBg";
	}
	else if(id == 2)
	{
		document.getElementById("introSection2").style.visibility	= 'visible';
		document.getElementById("introSection2").style.display		= 'block';
		document.getElementById("introSection1").style.visibility 	= 'hidden';
		document.getElementById("introSection1").style.display 	= 'none';
		document.getElementById("introSection3").style.visibility 	= 'hidden';
		document.getElementById("introSection3").style.display 	= 'none';
		document.getElementById("introHead2").className = "tabHeadBgHover";
		document.getElementById("introHead1").className = "tabHeadBg";
		document.getElementById("introHead3").className = "tabHeadBg";
	}
	else
	{
		document.getElementById("introSection1").style.visibility	= 'visible';
		document.getElementById("introSection1").style.display		= 'block';
		document.getElementById("introSection2").style.visibility 	= 'hidden';
		document.getElementById("introSection2").style.display 	= 'none';
		document.getElementById("introSection3").style.visibility 	= 'hidden';
		document.getElementById("introSection3").style.display 	= 'none';
		document.getElementById("introHead1").className = "tabHeadBgHover";
		document.getElementById("introHead2").className = "tabHeadBg";
		document.getElementById("introHead3").className = "tabHeadBg";
	}
}

function Check_Zipcode(frm)
{
	with(frm)
	{
    	if(!IsEmpty(zipcode, "Please enter zipcode."))
        {
			return false;
        }
    	else if(!IsZip(zipcode, "Please enter valid zipcode."))
        {
			return false;
        }
		return true;
	}
}
//====================================================================================================
//	Function Name	:	UploadImage_Change
//----------------------------------------------------------------------------------------------------
function UploadImage_Change(obj, imgTag, defaultVal, defaultWidth)
{
	imgTag.width = 120;

	if(obj.value == '')
		imgTag.src = defaultVal;
	else
	{
		imgTag.src = obj.value;
		
		if(defaultWidth != '')
			imgTag.width = defaultWidth;
	}
}

function changeTabTo(Start, masId, chId, totalTab, clsActive, clsInactive, fnCall)
{
	for(i=Start; i<totalTab; i++)
	{
		if(i==chId)
		{
			if(clsActive)
				document.getElementById('tab'+masId+'_'+i).className 			= clsActive;
			
			document.getElementById('tabContent'+masId+'_'+i).style.display 	= '';

			document.getElementById('tab'+masId+'_'+i+'_div1').className 		= "tabLeft";
			document.getElementById('tab'+masId+'_'+i+'_div2').className 		= "tabBg";
			document.getElementById('tab'+masId+'_'+i+'_div3').className 		= "tabRight";
			if(fnCall)
				eval('setTimeout("' + fnCall + '", 5000);');
		}
		else
		{
			if(clsInactive)
				document.getElementById('tab'+masId+'_'+i).className 			= clsInactive;
			
			document.getElementById('tabContent'+masId+'_'+i).style.display 	= 'none';
			
			document.getElementById('tab'+masId+'_'+i+'_div1').className 		= "tabLeft";
			document.getElementById('tab'+masId+'_'+i+'_div2').className 		= "tabBg";
			document.getElementById('tab'+masId+'_'+i+'_div3').className 		= "tabRight";
		}
	}
}

function confirmExit()
{
	if(document.getElementById('nextstep').value != '')
	{
		return 'You are in the middle of filling out your application for insurance quote. If you leave this page before finishing the form, you will submit an incomplete form with missing information. Do you want to continue?';
	}
}


