﻿// JScript File
function popResult(id)
{
    window2=window.open('quickpolls/quickpollresult.aspx?' + id,'QuickPollResult','left='+(screen.width - 350)/2+',top='+(screen.height - 600)/2+',height=600,width=350,toolbar=no,menubar=no,titlebar=no,resizable=no,scrollbars=no')
}

function popResult2(id)
{
    window2=window.open('quickpollresult.aspx?' + id,'QuickPollResult','left='+(screen.width - 350)/2+',top='+(screen.height - 600)/2+',height=600,width=350,toolbar=no,menubar=no,titlebar=no,resizable=no,scrollbars=no')
}

function popPolls()
{
	window1=window.open('quickpolls/previouspolls.aspx','PreviousPolls','left='+(screen.width - 500)/2+',top='+(screen.height - 500)/2+',height=500,width=500,toolbar=no,menubar=no,titlebar=no,resizable=no,scrollbars=yes')
}

/*
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
*/

function bookmarksite(title,url) {
    if (window.sidebar) { 
        window.sidebar.addPanel(title, url,""); 
    } else if( document.all ) {
        window.external.AddFavorite( url, title);
    } else if( window.opera && window.print ) {
        return true;
    }
}


function popImage(id)
{
    window1=window.open('Preview.aspx?' + id,'Preview','left='+ (screen.width - 800)/2 +',top='+(screen.height - 600)/2+',height=600,width=800,toolbar=no,menubar=no,titlebar=no,resizable=no,scrollbars=no')
}



function MaxLength(field, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
}


function SameAddress(obj)
{
	if(obj.checked)
	{
    document.all.ctl00_ContentPlaceHolder1_ctl00_txtAddress.value = document.all.ctl00_ContentPlaceHolder1_ctl00_hdAddress.value;
    document.all.ctl00_ContentPlaceHolder1_ctl00_txtCity.value=document.all.ctl00_ContentPlaceHolder1_ctl00_hdCity.value;
    document.all.ctl00_ContentPlaceHolder1_ctl00_txtZipCode.value=document.all.ctl00_ContentPlaceHolder1_ctl00_hdZip.value;
    document.all.ctl00_ContentPlaceHolder1_ctl00_txtPhone1.value=document.all.ctl00_ContentPlaceHolder1_ctl00_hdPhone1.value;
    document.all.ctl00_ContentPlaceHolder1_ctl00_txtPhone2.value=document.all.ctl00_ContentPlaceHolder1_ctl00_hdPhone2.value;


        for (var i=0; i<document.all.ctl00_ContentPlaceHolder1_ctl00_drpCountries.length; i++)
        {
                if(document.all.ctl00_ContentPlaceHolder1_ctl00_drpCountries.options[i].value==document.all.ctl00_ContentPlaceHolder1_ctl00_hdCountry.value)
                {document.all.ctl00_ContentPlaceHolder1_ctl00_drpCountries.options[i].selected = true;
                //break;
                }
        }

        for (var i=0; i<document.all.ctl00_ContentPlaceHolder1_ctl00_drpStates.length; i++)
        {
                if(document.all.ctl00_ContentPlaceHolder1_ctl00_drpStates.options[i].value==document.all.ctl00_ContentPlaceHolder1_ctl00_hdState.value)
                {document.all.ctl00_ContentPlaceHolder1_ctl00_drpStates.options[i].selected = true;
                break;
                }
        }
    }
}

function IsNumber(obj)
{
	if (event.keyCode < 48 || event.keyCode > 57){ 
    	    if(event.keyCode!=45&&event.keyCode!=36&&event.keyCode!=46&&event.keyCode!=35&&event.keyCode!=20&&event.keyCode!=9&&event.keyCode!=8&&event.keyCode!=39&&event.keyCode!=37)
    	    {    	    
    	        event.returnValue = false;	    
    	    }
	}
}


  function HandleImageSwap(source)
{ //alert(source);
    tmpImage = new Image();
    tmpImage.src = source;   	
    var filename = source.substring(source.lastIndexOf('/')+1,source.length);
    document.getElementById('ctl00_ContentPlaceHolder1_imgLarge').style.visibility="hidden"
    setTimeout('imgDisplay(tmpImage)',100);
    document.getElementById('ctl00_ContentPlaceHolder1_imgLarge').style.visibility="visible"
     
}
function imgDisplay(img)
{
    document.getElementById('ctl00_ContentPlaceHolder1_imgLarge').src = img.src;
}


function getPrint(strid)
{	
//			//Creating new page
//			var pp = window.open('','','left=20,top=0,width=800,height=700,toolbar=0,scrollbars=1, status=0');
//			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
//			pp.document.writeln('<HTML><HEAD><title>MYRVLINK.COM</title><LINK href=css/style.css  type="text/css" rel="stylesheet"/>')
//		    //Adding style sheet to hide print and close buttons
//			pp.document.writeln('<LINK href="css/PrintStyle.css"  type="text/css" rel="stylesheet" media="print"><base target="_self"><script language="javascript" type="text/javascript" src="js/JScript.js"></script></HEAD>')
//			//Adding Body Tagons
//			pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
//			//Adding form Taghg6y
//			
//			pp.document.writeln('<form>');
//			//Writing print area of the calling page
//			pp.document.writeln(document.getElementById(strid).innerHTML);
//		    //Creating two buttons Print and Close within a table
//			pp.document.writeln('<TABLE width=80%><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
//			
//			//Ending Tag of </form>, </body> and </HTML>
//			pp.document.writeln('</form></body></HTML>');	
//			pp.document.close();


var pp = window.open('','','left=20,top=0,width=800,height=700,toolbar=0,scrollbars=1, status=0');
var str_html='<html><head><LINK href=css/style.css  type="text/css" rel="stylesheet"/>';
str_html+='</head><body>';
str_html+=document.getElementById(strid).innerHTML;
//str_html+='<TABLE width=80%><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>';
str_html+='<TABLE width=100%><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>';
str_html+='</body></html>';
pp.document.writeln(str_html);
pp.document.close();

	
			}
			function getPrint1(strid)
            {
            
var pp = window.open('','','left=20,top=0,width=685,height=800,scrollbars=1, status=0,toolbar=no,location=no,resizable=no');
var str_html='<html><head><LINK href=css/style.css  type="text/css" rel="stylesheet"/>';
str_html+='</head><body>';
str_html+=document.getElementById(strid).innerHTML;
//str_html+='<TABLE width=80%><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>';
str_html+='<TABLE width=100%><TR height="10px"><TD height="10px"></TD></TR><br/><br/><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>';
str_html+='</body></html>';
pp.document.writeln(str_html);
pp.document.close();
            }	
		
			
			function getPrinthead(strid,heading)
           {	
			//Creating new page
			var pp = window.open('','','left=0,top=0,width=500,height=500,toolbar=0,resizable=yes scrollbars=yes,status=0');
			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
			pp.document.writeln('<HTML><HEAD><title></title><LINK href=css/style.css  type="text/css" rel="stylesheet">')
		    //Adding style sheet to hide print and close buttons
			pp.document.writeln('<LINK href="css/PrintStyle.css"  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
			//Adding Body Tag
			pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
			//Adding form Tag
			
			pp.document.writeln('<form>');
			//Writing print area of the calling page
		//	pp.document.writeln('<br><TABLE width=80%><TR><TD></TD></TR><TR><TD align="center"><Input  ID ="PRINT" type="image" src="../images/btns/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="../images/btns/close.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			pp.document.writeln('<table width=90%>');
			pp.document.writeln('<br><BR>');
		    pp.document.writeln('<tr><td></td><td align="center"></td><td  align="center"></td></tr>')
		    
			pp.document.writeln('<tr><td align="center" colspan="3"><font face="verdana" size="2"><b> '+heading+'</b>');
		  	pp.document.writeln('<br>');
			pp.document.writeln('<TR><td align="center" colspan="3">');
			pp.document.writeln("<table width=80% align='center'><tr><td align='center'>"+document.getElementById(strid).innerHTML+'</td></tr></table>');
		    
		    pp.document.writeln('</td></tr>');
		    //Creating two buttons Print and Close within a table
		    pp.document.writeln('<tr><td colspan="3">');
			pp.document.writeln('<TABLE width=90% align="center"><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			pp.document.writeln('</td></tr>');
			
			pp.document.writeln('</table>');
			pp.document.writeln('</form></body></HTML>');			
			
}
function getPrintchart(strid)
{	
			//Creating new page
			var pp = window.open('','','left=0,top=0,width=500,height=500,toolbar=0,resizable=yes scrollbars=yes,status=0');
			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
			pp.document.writeln('<HTML><HEAD><title></title><LINK href=css/style.css  type="text/css" rel="stylesheet">')
		    //Adding style sheet to hide print and close buttons
			pp.document.writeln('<LINK href="css/PrintStyle.css"  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
			//Adding Body Tag
			pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
			//Adding form Tag
			
			pp.document.writeln('<form>');
			//Writing print area of the calling page
		//	pp.document.writeln('<br><TABLE width=80%><TR><TD></TD></TR><TR><TD align="center"><Input  ID ="PRINT" type="image" src="../images/btns/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="../images/btns/close.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			pp.document.writeln('<table width=90%>');
			pp.document.writeln('<br><BR>');
		    pp.document.writeln('<tr><td></td><td align="center"></td><td  align="center"></td></tr>')
		    
			pp.document.writeln('<tr><td align="center" colspan="3"><font face="verdana" size="2" ><b> </b>');
		  	pp.document.writeln('<br>');
			pp.document.writeln('<TR><td align="center" colspan="3">');
			pp.document.writeln('<table width=80% align=center><tr><td align=center><img src="../Charts/temp/'+ strid +'" /></td></tr></table>');
		    
		    pp.document.writeln('</td></tr>');
		    //Creating two buttons Print and Close within a table
		    pp.document.writeln('<tr><td colspan="3">');
			pp.document.writeln('<TABLE width=90% align="center"><TR><TD></TD></TR><TR><TD align=center><Input  ID ="PRINT" type="image" src="images/print.gif" onclick="javascript:location.reload(true);window.location.reload(true);window.print();">&nbsp;&nbsp;&nbsp;<INPUT ID="CLOSE" type="image" src="images/close_btn.gif" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			pp.document.writeln('</td></tr>');
			
			pp.document.writeln('</table>');
			pp.document.writeln('</form></body></HTML>');	
			return false;		
			
}
//Function for Rv comparison
function ShowHideEmailBox()
{
    document.getElementById('ctl00_ContentPlaceHolder1_wizCompareRv_lblStatus').innerHTML='';
    var pnlObj = document.getElementById('divPnlObj');
    if(pnlObj.style.display=="none")
        pnlObj.style.display="block";
    else
        pnlObj.style.display="none";
}	

//function ValidateForm(){
//alert(document.getElementById('ctl00_ContentPlaceHolder1_wizCompareRv_divTableData').innerHtml);
//document.getElementById('ctl00_ContentPlaceHolder1_wizCompareRv_hdnHtmlContent').value=document.getElementById('ctl00_ContentPlaceHolder1_wizCompareRv_divTableData').innerHtml;

//}	

function validateEmailForm()
{
    var str=document.getElementById("ctl00_ContentPlaceHolder1_wizCompareRv_txtEmail").value;
    if(str!='')
    {
        var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if(str.match(emailRegEx)){
            return true;
        }else{
            alert("Enter valid email.");
            document.getElementById("ctl00_ContentPlaceHolder1_wizCompareRv_txtEmail").focus();
            return false;
        }
    }
    else
    {
        alert("Enter email.");
        document.getElementById("ctl00_ContentPlaceHolder1_wizCompareRv_txtEmail").focus();
        return false;
    }
}