var domainurl = "http://" + window.location.toString().split("//")[1].split("/")[0] + "/";

function fontsizeup()
{
	var active = getActiveStyleSheet();

	switch (active)
	{
		case 'A--':
			setActiveStyleSheet('A-');
		break;

		case 'A-':
			setActiveStyleSheet('A');
		break;

		case 'A':
			setActiveStyleSheet('A+');
		break;

		case 'A+':
			setActiveStyleSheet('A++');
		break;

		case 'A++':
			setActiveStyleSheet('A');
		break;

		default:
			setActiveStyleSheet('A');
		break;
	}
}

function fontsizedown()
{
	active = getActiveStyleSheet();

	switch (active)
	{
		case 'A++' : 
			setActiveStyleSheet('A+');
		break;

		case 'A+' : 
			setActiveStyleSheet('A');
		break;

		case 'A' : 
			setActiveStyleSheet('A-');
		break;

		case 'A-' : 
			setActiveStyleSheet('A--');
		break;

		case 'A--' : 
		break;

		default :
			setActiveStyleSheet('A--');
		break;
	}
}

function setActiveStyleSheet(title)
{
	var i, a, main;

	for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
	{
		if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title'))
		{
			a.disabled = true;
			if (a.getAttribute('title') == title)
			{
				a.disabled = false;
			}
		}
	}
}

function getActiveStyleSheet()
{
	var i, a;

	for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
	{
		if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled)
		{
			return a.getAttribute('title');
		}
	}

	return null;
}

function getPreferredStyleSheet()
{
	return ('A-');
}

function createCookie(name, value, days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime() + (days*24*60*60*1000));
		var expires = '; expires=' + date.toGMTString();
	}
	else
	{
		expires = '';
	}

	document.cookie = name + '=' + value + expires + '; path=/';
}

function readCookie(name)
{
	var nameEQ = name + '=';
	var ca = document.cookie.split(';');

	for (var i = 0; i < ca.length; i++)
	{
		var c = ca[i];

		while (c.charAt(0) == ' ')
		{
			c = c.substring(1, c.length);
		}

		if (c.indexOf(nameEQ) == 0)
		{
			return c.substring(nameEQ.length, c.length);
		}
	}

	return null;
}

function load_cookie()
{
	var cookie = readCookie('style_cookie');
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
}

function unload_cookie()
{
	var title = getActiveStyleSheet();
	createCookie('style_cookie', title, 365);
}

onload_functions.push('load_cookie()');
onunload_functions.push('unload_cookie()');

/*
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
*/

function submitLogin()
{
 $.ajax({'type': 'POST', 'url': domainurl +'login.html', 'data': $('#loginForm').serialize(),success: function(data){$('#loginAndMemberContainer').html(data);}});
}

function trackingPageContent(pageType,objectId,objectType)
{
	   var URL= domainurl +'tracking.html?pageType='+pageType+'&objectType='+objectType;
	   if(objectId!=0)
	     URL=URL+'&objectId='+objectId;
	   $.ajax({'type': 'GET', 'url':URL , success:function(data){$('#bodyContent').html(data)}});
}

function checkScreenWidth(){
	var sc = screen.width;
	var sh = screen.height;
	sc=sc-100;
	var alpha = document.getElementById('trans');
	alpha.style.width = sc+'px';
	alpha.style.height = sh+'px';
	document.getElementById('trans').style.height=document.body.clientHeight+ 20 + "px";
	document.getElementById('trans').style.width=document.body.clientWidth + "px"; 	
}

function submitCommunityLogin()
{
 $.ajax({'type': 'POST', 'url': domainurl +'login.html?param=alternate', 'data': $('#communityLoginId').serialize(),success: function(data){$('#altId').html(data);}});

}


function showForgotPassword()
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': domainurl +'forgotPassword.html', 'data': $('#forgotPasswordForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
 $('#trans').css('display','inline');
 $('#forgotPasswordPopUpLayerBody').css('display','inline');
}

function postForgotPassword()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': domainurl +'forgotPassword.html', 'data': $('#forgotPasswordForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
 $('#trans').css('display','inline');
 $('#forgotPasswordPopUpLayerBody').css('display','inline');
}


function checkEnterKey(e)
{
    var key;

	if(window.event)
		key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if(key == 13)
	{
		submitLogin();
	}
}

function onEnterKeyPress(e)
{
    var key;

	if(window.event)
		key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if(key == 13)
	{
		postForgotPassword();
	}
}

function onEnterKeyPressOnChangeMail(e)
{
    var key;

	if(window.event)
		key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if(key == 13)
	{
		postChangeEmail();
	}
}

function showChangeEmail()
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': domainurl +'changeEmail.html', 'data': $('#changeEmailForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function postChangeEmail()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': domainurl +'changeEmail.html', 'data': $('#changeEmailForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function onEnterKey(e)
{
    var key;

	if(window.event)
		key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if(key == 13)
	{
		postChangeEmail();
	}
}



function setErrorData(){
    
    var data= document.getElementById('errorDiv').innerHTML;
   
    if(data!=null||data!='undefined')
    {
     document.getElementById('errorData').innerHTML=data;
    }
}
function setRegMsg(referrer){    

    var endcodedString= encodeURIComponent(referrer);
    var data= document.getElementById('regMsg').innerHTML;    

    if(data!=null||data!='undefined')
    {
      document.getElementById('errorData').innerHTML=data;
    }          
    if(document.getElementById('userlinkId')!=null)
    {
     //alert(document.getElementById('userlinkId').href);
      document.getElementById('userlinkId').href=document.getElementById('userlinkId').href+"?referringPage="+endcodedString;
     //alert(document.getElementById('userlinkId').href);
    }
    if(document.getElementById('loggedInUserlinkId')!=null)
    {
      document.getElementById('loggedInUserlinkId').href=document.getElementById('loggedInUserlinkId').href+"?referringPage="+endcodedString;
    }   
    document.getElementById('messageId').innerHTML="Message";
}

function toggleBarWithGIFExt(imageName){
	document.getElementById('navigation').src='../images/'+imageName;
}

function toggleBarWithGIFExt1(imageName){
	document.getElementById('navigation').src='../images/navigation/'+imageName;
}

function showErrors(divId){
    checkScreenWidth();
    if(document.getElementById('trans')!=null)
    {
	 $('#trans').css('display','inline');
    }
	if(divId!=null)
	{
	 $(divId).css('display','inline');
	}
}

function hideErrors(){
	$('#trans').css('display','none');
	$('#layer').css('display','none');
	$('#showRefLayer').css('display','none');
}

function showAllSubCategory()
{
 $.ajax({'type': 'GET', 'url': domainurl +'getAllPopularSubCategories.html', 'data': $('#form').serialize(),async:false, success: function(data){$('#moreCategoryData').html(data);}}); 
}
function showAllMostRecentWiki()
{
 $.ajax({'type': 'GET', 'url': domainurl +'getAllMostRecentWiki.html', 'data': $('#form').serialize(), async:false, success: function(data){$('#wikiData').html(data);}}); 
}
function showPopupLayer(divName)
{
  document.getElementById('showdata').style.display='block';
}
function hideLayer()
{
  document.getElementById('showdata').style.display='none';
}

function showVendorDetail(vendorId)
{
   window.location="vendorDetail.html?vendorId="+vendorId
}

function showReferences(vendorId)
{
 $.ajax({'type': 'POST', 'url': domainurl +'vendorReferences.html?vendorId='+vendorId, 'data': $('#loginForm').serialize(),success: function(data){$('#showRefMainContainer').html(data);}});
}

function showReferenceLayer()
{	
	$('#showRefLayer').css('display','inline');
}

function setLayerData(){
    
    var data= document.getElementById('refDiv').innerHTML;
    document.getElementById('layerMainContainer').innerHTML=data;
}

function rateAVendor(vendorId)
{
  window.location="rateVendor.html?vendorId="+vendorId;
}

function setTextFocus(elementId) 
{ 
	document.getElementById(elementId).focus();  
}



function pagination(pageno)
{
   document.getElementById('pageno').value=pageno;
   document.searchForm.submit();
}

function showPopUp(divId){
	document.getElementById(divId).style.display="inline";	
}
function closePopUp(divId){
	document.getElementById(divId).style.display="none";	
}
function showLogin(divId){
   	document.getElementById(divId).style.display="inline";	
	document.getElementById("trans").style.display="inline";
}
function closeLogin(divId){
	document.getElementById(divId).style.display="none";	
	document.getElementById("trans").style.display="none";
	document.getElementById('messageId').innerHTML="An error has occurred:";
}

function toggleBar(imageName){
	document.getElementById('navigation').src='images/'+imageName+'.gif';
}

function toggleBar1(imageName){
	document.getElementById('navigation').src='images/navigation/'+imageName+'.gif';
}

function showAllSearches()
{
 $.ajax({'type': 'GET', 'url': domainurl +'getAllPopularSearches.html', 'data': $('#form').serialize(),async:false, success: function(data){$('#moreSearches').html(data);}}); 
}

function showPopUpWelcomeLayer(divId){
    checkScreenWidth();
    var data= document.getElementById(divId).innerHTML;
    document.getElementById('forgotPasswordPopUpLayerBody').innerHTML=data;
    $('#trans').css('display','inline');
 	$('#forgotPasswordPopUpLayerBody').css('display','inline');
}
/*JS for FAQ Page Start*/
var allPageTags = new Array();
var count=0;
function showFAQ(questionId) {
	var onClass="questionShow";
	var offClass="questionHide"; 
	
	var allPageTags=document.getElementsByTagName("*");
	for (i=0; i<allPageTags.length; i++){
	   if (allPageTags[i].className==onClass){
			allPageTags[i].className=offClass;
		}
	}
	document.getElementById(questionId).className =onClass;
}
function closeFaqPopUp(questionId){
	var offClass="questionHide"; 
	document.getElementById(questionId).className =offClass;	
}
function printVendorDetail(vendorId)
{ 
 window.open(domainurl +"printVendorDetail.html?vendorId="+vendorId,"mywindow","status=1,scrollbars=1,width=1000px,height=600px");
}

/*JS for FAQ Page End*/

function checkScreenWidth(){
	var sc = screen.width;
	var sh = screen.height;
	sc=sc-100;
	var alpha = document.getElementById('trans');	
	if(alpha!=null)
	{
		 alpha.style.width = sc+'px';
		 alpha.style.height = sh+'px';
		 document.getElementById('trans').style.height=document.body.clientHeight+ "px";
		 document.getElementById('trans').style.width=document.body.clientWidth + "px"; 	
	}
}

function submitOnEnterKeyPress(e)
{
    var key;

	if(window.event)
		key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if(key == 13)
	{
		document.getElementById('searchForm').submit();
	}
}

function submitAdvertiserLogin()
{
	document.advertiserRegistrationForm.submit();
	
}

function changeDocumentTitle(titleText)
{
  document.title=titleText;
}

function showSampleLead(id,subCategoryName,categoryName,stepInfo)
{
  document.getElementById('subCategory').innerHTML=subCategoryName;
  document.getElementById('category').innerHTML=categoryName;
  var changeURL=document.getElementById('urlId').href;
  if(stepInfo)
  document.getElementById('urlId').href='placeOrder.html?showStep4=true&subCategoryId='+id;
  else
  document.getElementById('urlId').href='placeOrder.html?subCategoryId='+id;
  document.getElementById('beAdverMidRt').style.display="inline";
  document.getElementById('beAdverMidTblDiv').innerHTML="Sample Lead for "+subCategoryName;
}

function orderListBySubCategory(subCategoryId)
{
  window.location='orderSummary.html?subCategoryId='+subCategoryId;
}

function sortListBySubCategory(subCategoryId,sorter)
{
  window.location=domainurl +'orderSummary.html?subCategoryId='+subCategoryId+'&sorter='+sorter;
}

function callme()
{
 document.getElementById('reqContactLink').href="leadWizard.html?step=1&subcategoryId="+document.getElementById('find1').value;
 document.getElementById('reqContactLinkFeaturedVendor').href="leadWizard.html?step=1&subcategoryId="+document.getElementById('find1').value;
}



function hidePopUp()
{
document.getElementById('categoriesMorePopUp').style.display="none";	
document.getElementById('popularMorePopUp').style.display="none";	
document.getElementById('viewMorePopUp1').style.display="none";	
document.getElementById('helpPopUp').style.display="none";	
document.getElementById('searchPopUp').style.display="none";	
document.getElementById('viewMorePopUp').style.display="none";	
}

function hidePopUpMicrosite()
{
document.getElementById('helpPopUp').style.display="none";	
document.getElementById('searchPopUp').style.display="none";	
}

function orderListBySubCategoryMyBudget(subCategoryId)
{
 if(subCategoryId!=-1)
 {
  window.location='myBudget.html?subCategoryId='+subCategoryId;
 }else
 {
  window.location='myBudget.html';
 }
}

function advertiserLeadBySubCategory()
{
 var dropdownIndex = document.getElementById('orderShowAll').selectedIndex;
 var subCategoryId = document.getElementById('orderShowAll')[dropdownIndex].value;
 //alert(subCategoryId);
 if(subCategoryId!=-1)
 {
  window.location='advertiserLeads.html?subCategoryId='+subCategoryId;
 }else
 {
  window.location='advertiserLeads.html';
 }
}


function sortOrderMyBudget(subCategoryId,sorter)
{
  window.location=domainurl +'myBudget.html?subCategoryId='+subCategoryId+'&sorter='+sorter;
}

function orderListBySubCategoryMyDelivery(subCategoryId)
{
  window.location=domainurl +'myDelivery.html?subCategoryId='+subCategoryId;
}

function sortOrderMyDelivery(subCategoryId,sorter)
{
  window.location=domainurl +'myDelivery.html?subCategoryId='+subCategoryId+'&sorter='+sorter;
}

function setMyBudgetCheck(id1,id2)
{  
   document.getElementById(id1).checked="checked";
   document.getElementById(id2).checked=""; 
   document.getElementById(id2).value="false";
   document.getElementById(id1).value="true";
}

function submitOrders()
{
 document.myBudget.submit();
}

function updateOrders()
{

  document.myDeliveryForm.submit();
}
 function listBySubCategoryAdvertiserReports(subCategoryId,reportTypeInt)
{
      document.advertiserReportsForm.submit();
}

function reportTypeAdvertiserReports(key)
{
	/*window.location='advertiserReports.html?reportType='+key;*/
}

function showFilterList()
{
 $.ajax({'type': 'GET', 'url': domainurl +'filterList.html', 'data': $('#advertiserReportsForm').serialize(),  success: function(data){$('#adverGreyMidFil2').html(data);}}); 
}

function getEstimatedBidValue()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': domainurl +'getEstimatedBidValue.html', 'data': $('#placeOrderForm').serialize(), async:false,success: function(data){$('#estimatedBidValue').html(data);}}); 
}

function advertiserPagination(pageno)
{
	document.getElementById('pageno').value=pageno;
    document.advertiserReportsForm.submit();
}

function getAllTransactionRecords(pageno)
{
  document.getElementById('pageno').value=pageno;
  $.ajax({'type': 'POST', 'url': domainurl +'getAllTransactionRecords.html', 'data': $('#transactionForm').serialize(), async:false,success: function(data){$('#billingInfo').html(data);}}); 
}

function checkradio(dollarType,id,dollarBudget,leadBudget)
{  
       
	if(dollarType)
	{
	 //alert("Dollar is checked");
	 document.getElementById('budgetTypeIsDollar'+id).value="true";
	 document.getElementById('dollar'+id).checked="true";
	 document.getElementById('budInput1'+id).value=dollarBudget;
	}else
	{
	 
	 document.getElementById('budgetTypeIsLead'+id).value="true";
	 document.getElementById('lead'+id).checked="true";
	 document.getElementById('budInput2'+id).value=leadBudget;
	}
}

function changeValue(leadId,dollarId)
{
	document.getElementById(leadId).value=true;
	document.getElementById(dollarId).value=false;
}

function sortList(sorter)
{
	document.getElementById('sorter').value=sorter;
    document.advertiserReportsForm.submit();
}

function hideLayer(divId){	
    $('#trans').css('display','none');
	$(divId).css('display','none');	
}

function clearDateFields()
{
	if(document.getElementById('adverGreyMidDtIptTo').value!="")
	{
		document.getElementById('adverGreyMidDtIptTo').value="";
	}
	if(document.getElementById('adverGreyMidDtIptFrom').value!="")
	{
		document.getElementById('adverGreyMidDtIptFrom').value="";
	}
}
function updateDeliveryModes(mode)
{
 var deliveryMethod=document.getElementById('deliveryMethod');
 var deliveryMode=document.getElementById('deliveryMode');
 var optionValue=deliveryMethod.options[deliveryMethod.selectedIndex].value;
  if(optionValue=='HTTP')
  {
    deliveryMode.options[0].text="Web"
    deliveryMode.options[0].value="Web"
    deliveryMode.options[1]=null;
    deliveryMode.selectedIndex="0";
  }
  else
  {
   	deliveryMode.options[0].text="Real Time"
    deliveryMode.options[0].value="Real Time"
    deliveryMode.options[1]=new Option('Batch','Batch');
    if(mode=='Real Time')
    {
      deliveryMode.selectedIndex="0";
    }else  if(mode=='Batch')
    {
      deliveryMode.selectedIndex="1";
    }else
    {
   		deliveryMode.selectedIndex="0";
   	}
  }
  
}


function updateModes(mode,index)
{
 var deliveryMethod=document.getElementById('deliveryMethod'+index); 
 var deliveryMode=document.getElementById('deliveryMode'+index);
 var optionValue=deliveryMethod.options[deliveryMethod.selectedIndex].value;
  if(optionValue=='HTTP')
  {
    deliveryMode.options[0].text="Web"
    deliveryMode.options[0].value="Web"
    deliveryMode.options[1]=null;
    deliveryMode.selectedIndex="0";
  }
  else
  {
   	deliveryMode.options[0].text="Real Time"
    deliveryMode.options[0].value="Real Time"
    deliveryMode.options[1]=new Option('Batch','Batch');
    if(mode=='Real Time')
    {
      deliveryMode.selectedIndex="0";
    }
    else  if(mode=='Batch')
    {
      deliveryMode.selectedIndex="1";
    }
    else
    {
   		deliveryMode.selectedIndex="0";
   	}
  }
  
}

function searchUsingSorting()
{
  document.getElementById('searchForm').submit();
}

function showFilters(divId){
	document.getElementById(divId).style.display="inline";		
}
function hideFilters(divId){
	document.getElementById(divId).style.display="none";		
}

function setSearchTerm(searchTerm)
{
   document.getElementById('find').className='selIptBgColor';
   document.getElementById('searchId').className='';
   document.getElementById('searchId').value=searchTerm;
   document.getElementById('searchId').readonly=false;
   document.getElementById('searchSubCategoryId').checked="";
   document.getElementById('searchKeywordsId').checked="checked";
   document.getElementById('searchForm').submit();
}
function setSearchOption(id1,id2)
{
 if(id1=='find'){
 document.getElementById(id2).readonly="readonly"; 
 document.getElementById('searchSubCategoryId').checked="checked";
 document.getElementById('searchKeywordsId').checked="";
 document.getElementById('searchId').className='selIptBgColor';
 document.getElementById('find').className='';
 }else{
  document.getElementById(id2).readonly=""; 
  document.getElementById('searchSubCategoryId').checked="";
  document.getElementById('searchKeywordsId').checked="checked";
  document.getElementById('find').className='selIptBgColor';
  document.getElementById('searchId').className='';
 }
 
}

function applyCSSToOptions(ele1,ele2)
{
   if(!document.getElementById(ele2).readonly)
    {
       document.getElementById(ele2).className='selIptBgColor';
       document.getElementById(ele1).className='';
    }
}
function onFocusApplyCSS(ele1)
{
 if(ele1=='find'){
 document.getElementById('searchSubCategoryId').checked="checked";
 document.getElementById('searchKeywordsId').checked="";
 document.getElementById('searchId').className='selIptBgColor';
 document.getElementById('find').className='';
 }else 
 {
 document.getElementById('searchSubCategoryId').checked="";
 document.getElementById('searchKeywordsId').checked="checked";
 document.getElementById('searchId').className='';
 document.getElementById('find').className='selIptBgColor';
 }
}


function setSelectedSubCategory(subCategoryId)
{
   var list = document.getElementById('find');
       for(i=0;i<list.length;i++)
       {  
          if(list[i].value==subCategoryId){
              list.selectedIndex=i;     
              break;
             } 
       }
       document.getElementById('searchId').className='selIptBgColor';
	   document.getElementById('searchSubCategoryId').checked="checked";
	   document.getElementById('find').className='';
	   document.getElementById('searchKeywordsId').checked="";
	   document.getElementById('searchForm').submit();
}

function enableSearchField(ele1,ele2)
{
  document.getElementById(ele2).className='selIptBgColor';
  document.getElementById(ele1).className='';
  if(ele1=='find'){
   document.getElementById(ele1).tabIndex =5;
   document.getElementById(ele2).tabIndex =0;
   document.getElementById('searchSubCategoryId').checked="checked";  
   document.getElementById('searchKeywordsId').checked="";
  }else
  {
   document.getElementById(ele1).tabIndex =5;
   document.getElementById(ele2).tabIndex =0;
   if(document.getElementById('msCheckBox')!=null)
   {
    document.getElementById('msCheckBox').checked="";
    document.getElementById('msCheckBox').value="0";
   }
   document.getElementById('searchSubCategoryId').checked="";
   document.getElementById('find').value="-1";
   document.getElementById('searchKeywordsId').checked="checked";
  }
}

function showTabSection(id1,id2)
{
   document.getElementById(id1).style.display="";
    document.getElementById(id2).style.display="none";
}

function checkFunCall(tbodyId, imgId)
{
	var mainBlock = $(tbodyId);
	var mainImgId = $(imgId);
	
	if(mainBlock.className == 'displayInline'){
		mainImgId.src="images/enlargeIcon.gif"
		mainBlock.className = 'displayNone';
	}
	else{
		mainImgId.src="images/contractIcon.gif"
		mainBlock.className = 'displayInline';
	}
}

function showAddVendor(id)
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': domainurl +'addvendor.html?vendorId='+id, 'data': $('#addVendorForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function postAddVendor()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': domainurl +'addvendor.html', 'data': $('#addVendorForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function requestFeedback()
{
  var j=document.getElementById("selectedList").options.length;
  if (j>0)
  {
	checkScreenWidth();
 	$.ajax({'type': 'POST', 'url': domainurl +'requestnetworkfeedback.html', 'data': $('#contactListForm').serialize(), async:false,success: function(data){$('#responseDiv').html(data);}}); 
  }
  else
  {
   alert("Select at least one contact.")
  }
}


function addComment(projectVendorId)
{
 $.ajax({'type': 'POST', 'url': domainurl +'addComment.html?projectVendorId='+projectVendorId, 'data': $('#advertiserReportsForm').serialize(), async:false,success: function(data){$('#commentId'+projectVendorId).html(data);}}); 
}


function hidePopUp()
{
document.getElementById('categoriesMorePopUp').style.display="none";	
document.getElementById('popularMorePopUp').style.display="none";	
document.getElementById('viewMorePopUp1').style.display="none";	
document.getElementById('helpPopUp').style.display="none";	
document.getElementById('searchPopUp').style.display="none";	
document.getElementById('viewMorePopUp').style.display="none";	
}
function getValue()
{
 var rad_val;
 //alert(document.projectviewform.radio.length);
 if(document.projectviewform.radio.length==undefined)
	{
	  if (document.projectviewform.radio.checked)
	      {
	       rad_val = document.projectviewform.radio.value;
	     //alert(rad_val);
	      }
	}else{
			for (var i=0; i < document.projectviewform.radio.length; i++)
			   {
			   if (document.projectviewform.radio[i].checked)
			      {
			       rad_val = document.projectviewform.radio[i].value;
			       //alert(rad_val);
			      }
			   }
	     }
   document.getElementById("deleteButton").href="deleteProject.html?projectId="+rad_val;
   document.getElementById("modifyButton").href="editproject.html?projectId="+rad_val;
   document.getElementById("showVendorButton").href="myProjects.html?projectId="+rad_val;
}
function hidePopUp1()
{	
document.getElementById('helpPopUp').style.display="none";	
document.getElementById('searchPopUp').style.display="none";	
}

function addVendorToProject()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': domainurl +'addvendor.html', 'data': $('#addVendorForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}


function addComment(projectVendorId)
{

 $.ajax({'type': 'POST', 'url': domainurl +'addComment.html?projectVendorId='+projectVendorId, 'data': $('#advertiserReportsForm').serialize(), async:false,success: function(data){$('#commentId'+projectVendorId).html(data);}}); 
}


function checkAllBox()
{
 //alert(document.getElementById("selectAllbox").value);
 
 if(document.getElementById("selectAllbox").value=='false')
 {
  //alert(document.contactListForm.list.length);
  if(document.contactListForm.list.length==undefined)
  {
     document.contactListForm.list.checked=true;
  }
  else
  {
	  for(var i=0;i<document.contactListForm.list.length;i++)
	  {
	   document.contactListForm.list[i].checked=true;
	  }
	}  
 }
 else
 {
  //alert(document.contactListForm.list.length);
  for(var i=0;i<document.contactListForm.list.length;i++)
  {
   document.contactListForm.list[i].checked=false;
  } 
 }
 if(document.getElementById("selectAllbox").value=='false')
 {
  document.getElementById("selectAllbox").value='true';
 }
 else
 {
  document.getElementById("selectAllbox").value='false';
 }

}

function submitContactForm()
{
 var list=getSelectedCheckbox() ;
 //alert(list);
 document.contactListForm.action="deleteContact.html?list="+list;
 //alert("deleteContact.html?list="+list);
 document.contactListForm.submit();
}

function getSelectedCheckbox() {
buttonGroup=document.contactListForm.list;
   // Go through all the check boxes. return an array of all the ones
   // that are selected (their position numbers). if no boxes were checked,
   // returned array will be empty (length will be zero)
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            retArr.length = lastElement;
            retArr[lastElement] = buttonGroup[i].value;
            lastElement++;
         }
      }
   } else { // There is only one check box (it's not an array)
      if (buttonGroup.checked) { // if the one check box is checked
        // retArr.length = lastElement;
         //retArr[lastElement] = 0; // return zero as the only array value
         retArr=buttonGroup.value;
      }
   }
   return retArr;
} 
function showNetworkContact(vendorId,projectId)
{
 //alert(projectId);
 //alert(vendorId);
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': domainurl +'requestnetworkfeedback.html?initial=string&vendorId='+vendorId+"&projectId="+projectId, 'data': $('#contactListForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}
function showcontantSort(sort)
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': domainurl +'showContactsByInitial.html?initial='+sort, 'data': $('#contactListForm').serialize(), async:false,success: function(data){$('#contactListId').html(data);}}); 
}

function showcontantIndex(index,initial)
{
 $.ajax({'type': 'GET', 'url': domainurl +'requestnetworkfeedback.html?pageno='+index+'&initial='+initial, 'data': $('#contactListForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function showVendorMap(lat,lon)
{
//alert("vendor map function");
  $.ajax({'type': 'POST', 'url': domainurl +'googleMap.html?lat='+lat+"&lon="+lon, 'data': $('#googleform').serialize(), async:false,success: function(data){$('#mapId').html(data);}}); 
}

function showSubCategoryComments(subCategoryId)
{
  $.ajax({'type': 'POST', 'url': domainurl +'viewSubCategoryComments.html?subCategoryId='+subCategoryId, 'data': $('#subCategoryCommentsForm').serialize(), async:false,success: function(data){$('#subCategoryCommentsId').html(data);}}); 
}



function gotoForumPage(id)
{
   window.location.href="http://dev.insideup.com/phpbb/viewforum.php?f="+id;
}

function getMail() {
	var value;
	if (document.selectmailform.radiogroup.length == undefined) {
		if (document.selectmailform.radiogroup.checked) {
			value = document.selectmailform.radiogroup.value;
		}
	} else {
		for ( var i = 0; i < document.selectmailform.radiogroup.length; i++) {
			if (document.selectmailform.radiogroup[i].checked) {
				value = document.selectmailform.radiogroup[i].value;
			}
		}
	}

	if (value == 0) {
		document.getElementById('importHotmail').style.display = 'block';
		document.getElementById('importYahoo').style.display = 'none';
		document.getElementById('importGmail').style.display = 'none';
		document.getElementById('importAol').style.display = 'none';
		document.getElementById('importOther').style.display = 'none';
	}
	if (value == 1) {
		document.getElementById('importHotmail').style.display = 'none';
		document.getElementById('importYahoo').style.display = 'block';
		document.getElementById('importGmail').style.display = 'none';
		document.getElementById('importAol').style.display = 'none';
		document.getElementById('importOther').style.display = 'none';
	}
	if (value == 2) {
		document.getElementById('importHotmail').style.display = 'none';
		document.getElementById('importYahoo').style.display = 'none';
		document.getElementById('importGmail').style.display = 'block';
		document.getElementById('importAol').style.display = 'none';
		document.getElementById('importOther').style.display = 'none';
	}
	if (value == 3) {
		document.getElementById('importHotmail').style.display = 'none';
		document.getElementById('importYahoo').style.display = 'none';
		document.getElementById('importGmail').style.display = 'none';
		document.getElementById('importAol').style.display = 'block';
		document.getElementById('importOther').style.display = 'none';
	}
	if (value == 4) {
		document.getElementById('importHotmail').style.display = 'none';
		document.getElementById('importYahoo').style.display = 'none';
		document.getElementById('importGmail').style.display = 'none';
		document.getElementById('importAol').style.display = 'none';
		document.getElementById('importOther').style.display = 'block';
	}

}


function changelinks()
{
 var ind=window.location.href;
 //alert("changelinks called"+ind.indexOf("index.html"));
 if(ind.indexOf("index.html")>0)
 {
	 if(document.getElementById("cityselectbox").value!='sand')
	 {
	   //alert("value id not sandiego");
	   document.getElementById("googlesearchDiv").style.display="block";
	   document.getElementById("regsearchDiv").style.display="none";
	 }
	 else
	 {
	   //alert("value id  sandiego");
	   document.getElementById("regsearchDiv").style.display="block";
	   document.getElementById("googlesearchDiv").style.display="none";
	 }
 }

}

function changeSearchURL()
{
 if(document.getElementById("searchcity")!=null)
 {
	 document.getElementById("searchcity").value=document.getElementById("cityselectbox").value;
	 if(document.getElementById("cityselectbox").value!='sand')
	 {
	  document.searchForm.action="googleSearch.html";
	 }
	 else
	 {
	  document.searchForm.action="searchVendor.html";
	 }
 }
 //alert(document.searchForm.action);
}

function updateUserSessionCity()
{
  var city=document.getElementById("cityselectbox").value;
  $.ajax({'type': 'POST', 'url': 'updateCity.html?city='+city, 'data': $('#subCategoryCommentsForm').serialize(), async:false,success: function(data){$('#subCategoryCommentsId').html(data);}}); 
}

