function changeProductImgSrc(thumId)
{
	//thumb code------------------------------
	var thumb_src;
	thumb_src=$("imgThumb_"+thumId).src;
	
	var thumb_src_ext;
	thumb_src_ext=getFileExtension(thumb_src);
	
	var mySplitThumb = thumb_src.split(thumb_src_ext);
	
	thumb_src_remove=mySplitThumb[0].split("_thumb");
	
	thumb_src_change=thumb_src_remove[0]+thumb_src_ext;
	//alert(thumb_src_change)
	
		
	//image code------------------------
	var img_src;	
	img_src=$("product_main_img").src;
	
	var img_src_ext;
	img_src_ext=getFileExtension(img_src);
	
	var mySplitImg = img_src.split(img_src_ext);	
	img_src_change=mySplitImg[0]+"_thumb"+img_src_ext;
	
	//replace iamge and thumb-----
	$("imgThumb_"+thumId).src=img_src_change;
	$("product_main_img").src=thumb_src_change;
	
}

function getFileExtension(filename)
{
  
  var dot = filename.lastIndexOf(".");
  if (dot == -1)
    return "";
  var extension = filename.substr(dot, filename.length);
  return extension;
}

function getFileName(filename) 
{
  
  var dot = filename.lastIndexOf(".");
  if (dot == -1)
    return "";
  var name = filename.substr(1, dot);
  return name;
}



function calculateGetShopPrice(price,weekPrice,id)
{
	var totalPrice;
	totalPrice=document.getElementById('totalPrice').value;
	
	var totalWeekPrice;
	totalWeekPrice=document.getElementById('totalWeekPrice').value;
	
	if(document.getElementById(id).checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(price);
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(weekPrice);		
	}else  
	{
		totalPrice=parseInt(totalPrice)-parseInt(price);
		totalWeekPrice=parseInt(totalWeekPrice)-parseInt(weekPrice);
	}
	//setCookie('totalPrice',totalPrice);
	document.getElementById('totalPrice').value=totalPrice;
	document.getElementById('totalPriceSpan').innerHTML=totalPrice;
	document.getElementById('totalWeekPrice').value=totalWeekPrice;
	document.getElementById('totalWeekPriceSpan').innerHTML=totalWeekPrice;
}




function addListedItem(items,id)
{
	var totalListedItem;
	totalListedItem=document.getElementById('totalListedItem').value;
	if(document.getElementById(id).checked == true)
	{
		totalListedItem=parseInt(totalListedItem)+parseInt(items);		
	}else
	{
		totalListedItem=parseInt(totalListedItem)-parseInt(items);
	}
	
	document.getElementById('totalListedItem').value=totalListedItem;
	document.getElementById('totalListedItemSpan').innerHTML=totalListedItem;
	
}




function loadGetShopPrice()
{
	
	var totalListedItem;
	totalListedItem=20;
	
	var totalPrice;
	totalPrice=2000;	
	
	var totalWeekPrice;
	totalWeekPrice=150;
	
	if(document.getElementById("more_item_20").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(200);				
		totalListedItem=parseInt(totalListedItem)+parseInt(20);
		
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(25);
	}
	if(document.getElementById("more_item_40").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(400);	
		totalListedItem=parseInt(totalListedItem)+parseInt(40);
		
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(50);
	}
	if(document.getElementById("generic_enquiry").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(20);		
	}
	if(document.getElementById("animated_banner").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(50);		
	}
	if(document.getElementById("priority_listing").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(50);		
	}
	if(document.getElementById("industry_leader").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(1000);	
		
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(150);	
	}
	if(document.getElementById("homepage_advert").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(500);		
	}
	if(document.getElementById("category_advert").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(200);		
	}
	if(document.getElementById("own_category").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(400);		
	}
	if(document.getElementById("newsletter_advert").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(200);		
	}
	if(document.getElementById("newsletter_advertorial").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(1000);		
	}
	if(document.getElementById("facebook_setup").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(500);		
	}
	
	document.getElementById('totalListedItem').value=totalListedItem;
	document.getElementById('totalListedItemSpan').innerHTML=totalListedItem;
	
	document.getElementById('totalPrice').value=totalPrice;
	document.getElementById('totalPriceSpan').innerHTML=totalPrice;
	
	document.getElementById('totalWeekPrice').value=totalWeekPrice;
	document.getElementById('totalWeekPriceSpan').innerHTML=totalWeekPrice;
}


function loadGetListedPrice()
{
	
		
	var totalPrice;
	totalPrice=150;
	
	var totalWeekPrice;
	totalWeekPrice=15;
	
	if(document.getElementById("website_link").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(50);			
	}
	if(document.getElementById("animated_banner").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(50);
		
	}
	if(document.getElementById("priority_listing").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(20);		
	}
	if(document.getElementById("industry_leader").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(1000);
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(150);			
	}	

	if(document.getElementById("homepage_advert").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(500);		
	}
	if(document.getElementById("category_advert").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(200);		
	}
	if(document.getElementById("own_category").checked == true)
	{
		totalWeekPrice=parseInt(totalWeekPrice)+parseInt(400);		
	}
	if(document.getElementById("newsletter_advert").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(200);		
	}
	if(document.getElementById("newsletter_advertorial").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(1000);		
	}
	if(document.getElementById("facebook_setup").checked == true)
	{
		totalPrice=parseInt(totalPrice)+parseInt(500);		
	}
	document.getElementById('totalPrice').value=totalPrice;
	document.getElementById('totalPriceSpan').innerHTML=totalPrice;
	
	document.getElementById('totalWeekPrice').value=totalWeekPrice;
	document.getElementById('totalWeekPriceSpan').innerHTML=totalWeekPrice;
}

function setCookie(c_name,value)
{
	//var exdate=new Date();
	//exdate.setDate(exdate.getDate() + exdays);
	//var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	var c_value=escape(value);
	document.cookie=c_name + "=" + c_value;
}
