//========================set submit values =================
function setSubmitValue(val1,val2)
  {
//alert('val'+val);
 document.frm.submit.value=val1
 document.frm.design_select_id.value=val2
  }

//========================= click to enlarge thumbnails =============
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

var i=0;
function resize() {
  if (navigator.appName == 'Netscape') i=40;
  if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
  self.focus();
}


//==================================== remove a crtoon topic ==================== 
   function removeCartoonTopic(tid)
     {
       var answer = confirm("Are you sure to remove this cartoon topic?")
	if (answer){
                url='cartoonTopic.php?mode=remove&tid='+tid;
		window.location = url;
	}

    }
//==============================================================================


//==================================== remove a crtoon ocomment ====================
   function removeCartoonComment(tid,ccid)
     {
       var answer = confirm("Are you sure to remove this cartoon comment?")
        if (answer){
                url='cartoonComment.php?mode=remove&tid='+tid +'&ccid='+ccid;
                window.location = url;
        }

    }
//==============================================================================
//=================================Remove user==================================
    function removeBid(uid)
      {
        var answer = confirm("Are you sure want to remove this bid?")
          if (answer){
               document.myfrm.uid.value=uid;
               document.myfrm.mode.value="remove";
               document.myfrm.submit();
           }
     }

    function editBid(id)
      {
               document.myfrm.action= "advertBid.php?bidId=" + id + "&op=2";
               document.myfrm.mode.value="edit";
               document.myfrm.submit();
     }

//===================================================================================

//=================================Remove Art==================================
    function removeArt(aid) 
      {
        var answer = confirm("Are you sure to remove this art?")
          if (answer){
                     url='artExhibition.php?mode=remove&aid='+aid;
                     window.location = url; 
           } 
     }
//===================================================================================

//=================================Remove user==================================
    function removeUser(uid)
      {
       
        var answer = confirm("Are you sure to remove this user?")
          if (answer){
                   //  url='searchUser.php?mode=remove&uid='+uid;
                   //  window.location = url;
               document.myfrm.uid.value=uid;
               document.myfrm.mode.value="remove";
               document.myfrm.textfield.value=document.usersearch.textfield.value;
               document.myfrm.submit();
               
              // document.search.submit();
           }
     }
//===================================================================================

//=================================Activate user==================================
    function activateUser(uid)
      {
        var answer = confirm("Are you sure to activate this user?")
          if (answer){
                   //  url='searchUser.php?mode=remove&uid='+uid;
                   //  window.location = url;
               document.myfrm.uid.value=uid;
               document.myfrm.mode.value="active";
               document.myfrm.textfield.value=document.usersearch.textfield.value;
               document.myfrm.submit();
              // document.search.submit();
           }
     }
//===================================================================================

  //=================================Deactivate user==================================
    function deactivateUser(uid)
      {
        var answer = confirm("Are you sure to deactivate this user?")
          if (answer){
                   //  url='searchUser.php?mode=remove&uid='+uid;
                   //  window.location = url;
               document.myfrm.uid.value=uid;
               document.myfrm.mode.value="deactive";
               document.myfrm.textfield.value=document.usersearch.textfield.value;
               document.myfrm.submit();
              // document.search.submit();
           }
     }
//===================================================================================

  function getSearchKeywords()
      {
//alert('this is ');
    var key= document.usersearch.textfield.value;
     if(key=='search a member')
      document.usersearch.textfield.value="";

     }

//========================================================================================
//=========================================code for workernt orderby===========================================
   function inBoxsubmit1(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "inbox.php?oid=" + id;
          document.theform.submit();
        }
   function inBoxsubmit2(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "inbox.php?nid=" + id;
          document.theform.submit();
        }

   function inBoxsubmit3(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "inbox.php?rid=" + id;
          document.theform.submit();
        }
   function frmsubmit1(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "outbox.php?oid=" + id;
          document.theform.submit();
        }
   function frmsubmit2(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "outbox.php?nid=" + id;
          document.theform.submit();
        }
   function frmsubmit3(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.theform.action= "outbox.php?rid=" + id;
          document.theform.submit();
        }
   function myBidsubmit1(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.myfrm.action= "myBidding.php?oid=" + id;
          document.myfrm.submit();
        }
   function myBidsubmit2(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.myfrm.action= "myBidding.php?nid=" + id;
          document.myfrm.submit();
        }
   function myBidsubmit3(id)
        {
         // document.myfrm.textfield.value=document.usersearch.textfield.value;
          document.myfrm.action= "myBidding.php?rid=" + id;
          document.myfrm.submit();
        }

//=======================End Code workerant order by======================================================


//================================chandu for onchange=========================================
function subMetaCategory(){
        var cid = document.myform.category.value;
        var url ='subMetaCategory.php?cid='+cid;
        var dataString='cid='+cid;
        overlayFormSubmitter.postFormData(url,dataString,'subMetaCat');
        }

//==================================End=====================================================


//####################################Madhu's Code########################
function subcategory(){
        var cid = document.myform.main_category.value;
        var url ='subcategory.php?cid='+cid;
        var dataString='cid='+cid;
        overlayFormSubmitter.postFormData(url,dataString,'subcat');
	}
function serviceprovider(){
        var sid = document.myform.sub_category.value;
        var url ='serviceprovider.php?sid='+sid;
        var dataString='sid='+sid;
        overlayFormSubmitter.postFormData(url,dataString,'sprovider');
}
function userlink(){
        if(document.myform.invite_bidders.checked){
       	document.getElementById("bidlink").innerHTML='<a href="javascript:onclick=createUserProfileOverlay();">Browse Profile</a>';
        }else{
         document.getElementById("bidlink").innerHTML='';
        }
}
function saveuserlist(){
		var length1 = document.list.checklist.length;
	    document.getElementById("hid").innerHTML="";
	  //alert("lenghth1="+length1);
	    for( var i=0;i<length1;i++){
	    	if(document.list.checklist[i].checked){
			var val = document.list.checklist[i].value;
		        var content = "<input type='hidden' name='list_array[]'  value='" + val + "'>";
		        document.getElementById("hid").innerHTML += content;
	        }
            }
	       overlay.hide();
}

function bidprice(){
//      alert("value="+document.myform.elements.Select_Type.length);
        var bidradio = document.myform.elements.Select_Type;
        for (var i=-1, radio; radio=bidradio[++i];)     {
		if(radio.checked && radio.value == "lowest_price"){
        	document.getElementById("bid_type").innerHTML='Enter Starting Price&nbsp;&nbsp; &pound; <input type="text" name="lprice" class="txtfield" />';
		break;
		}
        if(radio.checked && radio.value == "get_quotes_price"){
        	document.getElementById("bid_type").innerHTML='<Select class="free_size_txtfield" name="get_price"><option value="50"> <&pound;50</option><option value="100"> <&pound;100</option><option value="250"> <&pound;250</option><option value="500"> <&pound;500</option><option value="1000"> <&pound;1000</option><option value="2500"> <&pound;2500</option><option value="5000"> <&pound;5000</option><option value="5000+"> <&pound;5000+</option></Select>';
		break;
		}
		if(radio.checked && radio.value=="fixed_price"){
        	document.getElementById("bid_type").innerHTML='Enter Fixed Price&nbsp;&nbsp;&pound; <input type="text" name="fixprice" class="txtfield" />';
		}
	}
}

function filechange1(){
        document.getElementById("fileupload1").innerHTML='<input name="Image1" type="file" class="free_size_txtfield" />';
}
function filechange2(){
        document.getElementById("fileupload2").innerHTML='<input name="Image2" type="file" class="free_size_txtfield" />';
}
function filechange3(){
        document.getElementById("fileupload3").innerHTML='<input name="Image3" type="file" class="free_size_txtfield" />';
}
function filechange4(){
        document.getElementById("fileupload4").innerHTML='<input name="Image4" type="file" class="free_size_txtfield" />';
}
function filechange5(){
        document.getElementById("fileupload5").innerHTML='<input name="Image5" type="file" class="free_size_txtfield" />';
}
function filechange6(){
        document.getElementById("fileupload6").innerHTML='<input name="Image6" type="file" class="free_size_txtfield" />';
}

function GetQuotes(){
        if(document.myform.contract_place.checked){
                document.getElementById("bid_quotes").innerHTML='<Select class="free_size_txtfield" name="get_quotes_val"><option value="">Select Quotes </option><option value="Sameday">Same day</option><option value="1-3days">1-3 days </option><option value="withinaweek">within a week </option><option value="notsure">not sure </option></select>';

        }else
        document.getElementById("bid_quotes").innerHTML='';
}
//=======================PortfolioLink=========================================================
function checklink(){
	var x=document.userlinks.portFee.value;
	var answer = confirm("You are currently a standard member. To create an online portfolio will cost \u00A3"+x+" per month. Would you like to create a portfolio now?")
          if (answer){

        document.userlinks.action= "userPortfolio.php";
	document.userlinks.submit();
	}
}
//----------------------------------------------------------
function portfolio(){

        document.userlinks.action= "userPortfolio.php";
        document.userlinks.submit();
}


//==========================Weblink=======================================================
function webpagelink(){
        document.getElementById("weblink").innerHTML='Enter Your WebPage Link<br><input type="text" name="webpage" class="txtfield1" value="http://"/><br><input type="submit" name="link2" value="Save" />';

}
//-----------------------------------------------------------------
function checkweblink(){
	var link_value = document.userlinks.link.value; 
        var answer = confirm("You have to pay \u00A3"+link_value+" on every click to your weblink.Would you like to upload this link now?")
          if (answer){
		document.getElementById("weblink").innerHTML='Enter Your WebPage Link<br><input type="text" name="webpage" class="txtfield1" value="http://"/><br><input type="submit" name="link2" value="Save" />';
        }
	else{
		document.getElementById("weblink").innerHTML='';
	}
}
//============================Function for User Services=================================
function checkServices(){
	var fee = document.about_user.fee.value;
        var answer = confirm("You have to pay \u00A3" + fee + " on uploding another service.Would you like to upload this now?");
          if (answer){
		document.about_user.action= "uploadServices.php";
		document.about_user.submit();	
	  }
}

