function trackingPageContent(pageType,objectId,objectType)
{
	   var URL= '/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 changeLink()
{
 document.getElementById('reqContactLink').href="/leadWizard.html?step=1&subcategoryId="+document.getElementById('find1').value;
}

function submitLogin()
{
 $.ajax({'type': 'POST', 'url': '/login.html', 'data': $('#loginForm').serialize(),async:false,success: function(data){$('#loginAndMemberContainer').html(data);}});
 //$.ajax({'type': 'POST', 'url': '/wiki/api.php?action=login&lgname=&lgpassword=&format=xml', 'data': $('#loginForm').serialize(),success: function(data){$('#fakeDiv').html(data);}});
}

function submitCommunityLogin()
{
 $.ajax({'type': 'POST', 'url': '/login.html?param=alternate', 'data': $('#communityLoginId').serialize(),success: function(data){$('#communityLogin').html(data);}});
// $.ajax({'type': 'POST', 'url': 'login.html?param=alternate', 'data': $('#communityLoginId').serialize(),success: function(data){$('#loginAndMemberContainer').html(data);}});
 //$.ajax({'type': 'POST', 'url': '/wiki/api.php?action=login&lgname=&lgpassword=&format=xml', 'data': $('#loginForm').serialize(),success: function(data){$('#fakeDiv').html(data);}});
}


function showForgotPassword()
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': '/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': '/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': '/changeEmail.html', 'data': $('#changeEmailForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}


function getTweets()
{
 $.ajax({'type': 'GET', 'url': '/getLatestTweets.html', success: function(data){$('#tweetcontent').html("");$('#tweetcontent').html(data);}}); 
}

function postChangeEmail()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': '/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;
   // alert(data);
   
    if(data!=null||data!='undefined')
    {
     //alert(document.getElementById('errorData'));
    // alert(document.getElementById('errorData').innerHTML);
     document.getElementById('errorData').innerHTML=data;     
    }
}

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': '/getAllPopularSubCategories.html', 'data': $('#form').serialize(),async:false, success: function(data){$('#moreCategoryData').html(data);}}); 
}
function showAllMostRecentWiki()
{
 $.ajax({'type': 'GET', 'url': '/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': '/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.searchForm.action="/searchvendor/"+document.getElementById("searchId").value;
   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': '/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("/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)
{
//   if(document.getElementById("cityselectbox").value!='sandiego')
//   {
//    document.searchForm.action="/googleSearch.html";	
//   }
//   else
//   {
     document.searchForm.action="/searchvendor/"+document.getElementById("searchId").value;
     document.getElementById("pageno").value="1";
	 document.getElementById('searchKeyword').value="true";
 //  }
	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='/orderSummary.html?subCategoryId='+subCategoryId+'&sorter='+sorter;
}

function updateLinks()
{
 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 subCategoryId = document.getElementById('subCategoryId').value;
  document.advertiserLeadForm.submit();
}

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

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

function sortOrderMyDelivery(subCategoryId,sorter)
{
  window.location='/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()
{
     document.advertiserReportsForm.submit();
}

function getOptionByOrderId(orderValue)
{
	var subCategoryId =document.getElementById("subCategoryIdShowAll").value
    var advertiserId =document.getElementById("advertiserId").value
	$.ajax({'type': 'POST', 'url': '/getOrderByOptionId.html?orderValue='+orderValue+'&subCategoryId='+subCategoryId+'&advertiserId='+advertiserId, 'data': $('#advertiserReportsForm').serialize(),  success: function(data){$('#orderTbl').html(data);}});
}

function getOptionByAttributeId(optionValue)
{
	document.getElementById("indexType").value=optionValue;
    $.ajax({'type': 'POST', 'url': '/filterList.html?optionValue='+optionValue, 'data': $('#advertiserReportsForm').serialize(),  success: function(data){$('#adverGreyMidFil2').html(data);}}); 
}

function getEstimatedBidValue()
{
  checkScreenWidth();
  //alert(document.getElementById("exclusive").checked);
  if(document.getElementById("exclusive").checked)
  {
     document.getElementById("test").value=true;
    
	 $.ajax({'type': 'POST', 'url': '/getEstimatedBidValue.html?exclusive=true', 'data': $('#placeOrderForm').serialize(), async:false,success: function(data){$('#estimatedBidValue').html(data);}}); 
  }
 else
 {
    document.getElementById("test").value=false;
  
    $.ajax({'type': 'POST', 'url': '/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': '/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.searchForm.action="/searchvendor/"+document.getElementById("searchId").value;
  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=='citySearch')
  {
   document.getElementById(ele1).tabIndex =8;
   document.getElementById(ele2).tabIndex =0;
   document.getElementById('searchByCity').checked="checked"; 
   document.getElementById('searchByZipCode').checked="";
   document.getElementById('searchByCity').value='true';
   document.getElementById('searchByZipCode').value='false';
   document.getElementById(ele2).value='';
  }else
  {
   document.getElementById(ele1).tabIndex =8;
   document.getElementById(ele2).tabIndex =0;
   document.getElementById('searchByCity').checked="";
   document.getElementById('searchByZipCode').checked="checked";
   document.getElementById('searchByZipCode').value='true';
   document.getElementById('searchByCity').value='false';
   document.getElementById(ele2).value='1';
  }
}

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': '/addvendor.html?vendorId='+id, 'data': $('#addVendorForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function postAddVendor()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': '/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': '/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': '/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(rad_val)
{
 //alert(document.projectviewform.radio.length);
	if(document.getElementById("deleteButton"+rad_val) != null)
	{
	   document.getElementById("deleteButton"+rad_val).href="/deleteProject.html?projectId="+rad_val;
	}
	if(document.getElementById("modifyButton"+rad_val) != null)
	{
	   document.getElementById("modifyButton"+rad_val).href="/editproject.html?projectId="+rad_val;
	}
	if(document.getElementById("showVendorButton"+rad_val) != null)
	{
	   document.getElementById("showVendorButton"+rad_val).href="/myProjects.html?projectId="+rad_val;
	}
	     //alert(rad_val);	     
	
}
function hidePopUp1()
{	
document.getElementById('helpPopUp').style.display="none";	
document.getElementById('searchPopUp').style.display="none";	
}

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


function addComment(projectVendorId)
{

 $.ajax({'type': 'POST', 'url': '/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 showProjectIdForAskNetwork(vendorId,buyerId)
{
	var projectId=0;
    $.ajax({'type': 'GET', 'url': '/getProjectIdForAskNetwork.html?vendorId='+vendorId+"&buyerId="+buyerId,async:false,success: function(data){projectId=data;}});
    showNetworkContact(vendorId,projectId);
}

function showNetworkContact(vendorId,projectId)
{
 //alert(projectId);
 //alert(vendorId);
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': '/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': '/showContactsByInitial.html?initial='+sort, 'data': $('#contactListForm').serialize(), async:false,success: function(data){$('#contactListId').html(data);}}); 
}

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

function showVendorMap(address)
{
  
  $.ajax({'type': 'POST', 'url': '/googleMap.html?address='+address, 'data': $('#googleform').serialize(), async:false,success: function(data){$('#mapId').html(data);}}); 
 
}

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



function gotoForumPage(id)
{
   window.location.href="/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;
	// alert(document.getElementById("searchcity").value);
//	 if(document.getElementById("cityselectbox").value!='sandiego')
//	 {
//	  document.searchForm.action="/googleSearch.html";
//	 }
//	 else
//	 {
	  document.searchForm.action="/searchvendor/"+document.getElementById("searchId").value;;
	//}
 }

 //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);}});
  changeSearchURL();
  if(window.location.href.indexOf('/searchvendor')>0)
  {  
    document.getElementById("pageno").value="1";
    document.getElementById('searchByCity').value='false';
    document.searchForm.submit();
  }
  else
  {
    window.location.reload(true); 
  }
}

function setRegMsg(referrer)
{     
    var endcodedString= encodeURIComponent(referrer); 
    var data= document.getElementById('loginlayer').innerHTML;     
    var url ='/login.html'+"?showLoginLayer=true&referringPage="+endcodedString; 
    $.ajax({'type': 'GET', 'url': url,success: function(data){$('#loginlayer').html(data);}});  
}

function closeLoginMessage(divId)
{
  document.getElementById(divId).style.display="none";	
  document.getElementById("trans").style.display="none";
}
function submitMessagePopUp()
{
  $.ajax({'type': 'POST', 'url': '/login.html?rand='+Math.random(), 'data': $('#messagePopUp').serialize(),async:false,success: function(data){$('#loginlayer').html(data);}});
}

function keywordSearch()
{
//	if(document.getElementById("cityselectbox").value=='sandiego')
//	{
	 document.searchForm.action="/searchvendor/"+document.getElementById("searchId").value;
//	}else{
//		document.searchForm.action="/googleSearch.html";
//	}
	 document.getElementById("pageno").value="1";
	 document.getElementById('searchKeyword').value="true";	
	 
}

function printPreviewLead(bidToken)
{ 	
   window.open("/printpreviewlead.html?token="+bidToken,"mywindow","status=1,scrollbars=1,width=1000px,height=600px");
}

function submitLeadBuyerLogin()
{
 $.ajax({'type': 'POST', 'url': '/login.html', 'data': $('#leadBuyerLogin').serialize(), async:false,success: function(data){$('#midSectionBox').html(data);}});
}

function projectPagination(pageno)
{  
   document.getElementById('pageno').value=pageno;
   document.projectviewform.submit();
}

function showChangePassword()
{
 checkScreenWidth();
 $.ajax({'type': 'GET', 'url': '/changepassword.html', 'data': $('#changePasswordForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
}

function postChangePassword()
{
 checkScreenWidth();
 $.ajax({'type': 'POST', 'url': '/changepassword.html', 'data': $('#changePasswordForm').serialize(), async:false,success: function(data){$('#forgotPasswordPopUpLayerBody').html(data);}}); 
 $('#trans').css('display','inline');
 $('#forgotPasswordPopUpLayerBody').css('display','inline');
}

function forumPagination(pageno)
{ 
   document.getElementById('forumpageno').value=pageno;
   $.ajax({'type': 'POST', 'url': 'activeforum.html?pageno='+pageno, 'data': $('#forumform').serialize(), async:false,success: function(data){$('#forumSubmit').html(data);}});
}

function deleteYahooData(vendorId,vendorName)
{
	if(confirm("Are you sure you want to delete ' "+vendorName+" ' ?")){
		$.ajax({'type': 'GET', 'url': '/deleteYahooSearchResult.html?vendorId='+vendorId});
		window.location.reload(true); 
	}
}

function deleteVendorProfile(vendorId,vendorName)
{
	if(confirm("Are you sure you want to delete ' "+vendorName+" ' ?")){
		$.ajax({'type': 'GET', 'url': '/deleteYahooSearchResult.html?vendorId='+vendorId});
		window.location='/index.html'; 
	}
}

function enableStateOrMetro(ele1,ele2)
{
  document.getElementById(ele2).selectedIndex=-1;
  if(ele1=='stateField')
  {
   document.getElementById(ele2).disabled=true;
   document.getElementById(ele1).disabled=false;
   document.getElementById('metroLinks').style.visibility='visible';
   document.getElementById('stateLinks').style.visibility='hidden';
   document.getElementById('hiddenStateOrMetro').value='false';
  }else
  {
	  document.getElementById(ele2).disabled=true;
	  document.getElementById(ele1).disabled=false;
	  document.getElementById('stateLinks').style.visibility='visible';
	  document.getElementById('metroLinks').style.visibility='hidden';
	  document.getElementById('hiddenStateOrMetro').value='true';
  }
}

function sortListByAdvertiserCredite(sorter)
{
  window.location='/advertiserCredite.html?sorter='+sorter;
}

function exclusiveORshared(ele1,ele2)
{
  if(ele1=='exclusive')
  {
    document.getElementById('test').value='true';
  }else
  {
    document.getElementById('test').value='false';
  }
}

function sortLeadList(sorter)
{
	document.getElementById('sorter').value=sorter;
    document.advertiserLeadForm.submit();
}

function leadListByDate(index)
{
	document.getElementById('index').value=index;
    document.advertiserLeadForm.submit();
}