var Ajax= new sack();

function  displayinfo()
{
//	alert(Ajax.response);
	eval(Ajax.response);
}

function goLocation(site_url,page_Id)
{
	if(document.getElementById('hid_SESSION').value==3)
	{
		window.location.href = site_url+'/vendor-admin/'+page_Id+'.html';
	}
	else
	{ 
		window.location.href = site_url+'/vendor-admin/featuredplus_only.html';
	}
}	 
function redirect(site_url,id)
{
	document.Form_Name.action = site_url+'/vendor-admin/vendor-welcome.html'; 	
	document.getElementById('hid_AdvPlan').value = id;
	document.Form_Name.submit();
}
function redirectVendor(site_url, group)
{
	document.Form_Name.action = site_url+'/vendor-admin/additional-service-areas.html';
	var selected = false;
	for(var k=0; k<group.length; k++) {
    	if(group[k].checked) {
    		selected = true;
    	}
    }
	if (selected == true) {
		document.Form_Name.submit();
	} else {
		alert("You must select a Vendor Plan to continue.");
	}
}
function redirectVendorAdmin(site_url, plan, group)
{
	var selected = false;
	for(var k=0; k<group.length; k++) {
    	if(group[k].checked) {
    		selected = true;
    	}
    }
	if (selected == true) {
		if (confirm("Are you sure you want to upgrade your plan? You will be charged accordingly.")) {
			document.Form_Name.submit();
		}
	} else {
		alert("You must select a Vendor Plan to continue.");
	}
}
function votePoll(site_url,vot_opt,poll_id)
{
	Ajax.requestFile = site_url+'/models/Ajax-Server.php?vot_opt='+vot_opt+'&poll_id='+poll_id;
	Ajax.onCompletion=displayinfo;
	Ajax.runAJAX();
}
function showPollResults(id)
{
	if(id==1)
	{
		//document.getElementById('Id_Poll').className='left_panel_inactive';
		//document.getElementById('Pop_Up').className='left_panel_active';
		//document.getElementById('pollQuestionBox').style.display='left_panel_inactive';
		document.getElementById('pollResultsBox').style.display='inline';
	}	
	
	if(id==2)
	{
		//document.getElementById('Id_Poll').style.display='left_panel_active';
		//document.getElementById('Pop_Up').style.display='left_panel_inactive';
		document.getElementById('pollResultsBox').style.display='none';
	}	
}

function validateSiteUrl()
{
	frm = document.Form_Name;
	if (GenValidation(frm.txt_durl,'your website','','') == '')
	{
		return false;
	}
	else if (GenValidation(frm.txt_lurl,'badge url','','') == '')
	{
		return false;
	}
	else
	{
		return true;
	}
}

function validateBadge()
{
	var category = document.getElementById('sel_Category');
	var badge = document.getElementById('html_link');
	if(category.value != '')
	{
		if(badge.value == '')
	    {
		alert('Please enter HTML Code(Text).');
		badge.focus();
		return false;
	    }
	}
	else
	{
		alert('Please select category.');
		category.focus();
		return false;	
	}
}
function getbadge()
{
	document.Form_Name.submit();
}

/*function displayLeftTabs(totTabs,parId)
{
	alert('hi');
}
*/

function showVendorPollResults(id)
{
	if(id==1)
	{
		//document.getElementById('Id_Poll').className='left_panel_inactive';
		//document.getElementById('Pop_Up').className='left_panel_active';
		//document.getElementById('pollQuestionBox').style.display='left_panel_inactive';
		document.getElementById('poll-box-results').style.display='';
	}	
	
	if(id==2)
	{
		//document.getElementById('Id_Poll').style.display='left_panel_active';
		//document.getElementById('Pop_Up').style.display='left_panel_inactive';
		document.getElementById('poll-box-results').style.display='none';
	}	
}

